Example usage for java.lang Class getName

List of usage examples for java.lang Class getName

Introduction

In this page you can find the example usage for java.lang Class getName.

Prototype

public String getName() 

Source Link

Document

Returns the name of the entity (class, interface, array class, primitive type, or void) represented by this Class object, as a String .

Usage

From source file:it.unimi.di.big.mg4j.tool.IndexBuilder.java

@SuppressWarnings({ "unchecked", "resource" })
public static void main(final String[] arg) throws JSAPException, InvocationTargetException,
        NoSuchMethodException, IllegalAccessException, ConfigurationException, ClassNotFoundException,
        IOException, InstantiationException, URISyntaxException {

    SimpleJSAP jsap = new SimpleJSAP(IndexBuilder.class.getName(),
            "Builds an index (creates batches, combines them, and builds a term map).",
            new Parameter[] {
                    new FlaggedOption("sequence", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'S',
                            "sequence", "A serialised document sequence that will be used instead of stdin."),
                    new FlaggedOption("ioFactory", JSAP.STRING_PARSER, "FILESYSTEM_FACTORY", JSAP.NOT_REQUIRED,
                            JSAP.NO_SHORTFLAG, "io-factory",
                            "An I/O factory that will be used to create files (either a static field of IOFactory or an object specification)."),
                    new FlaggedOption("objectSequence",
                            new ObjectParser(DocumentSequence.class, MG4JClassParser.PACKAGE), JSAP.NO_DEFAULT,
                            JSAP.NOT_REQUIRED, 'o', "object-sequence",
                            "An object specification describing a document sequence that will be used instead of stdin."),
                    new FlaggedOption("delimiter", JSAP.INTEGER_PARSER,
                            Integer.toString(Scan.DEFAULT_DELIMITER), JSAP.NOT_REQUIRED, 'd', "delimiter",
                            "The document delimiter (when indexing stdin)."),
                    new FlaggedOption("factory", MG4JClassParser.getParser(),
                            IdentityDocumentFactory.class.getName(), JSAP.NOT_REQUIRED, 'f', "factory",
                            "A document factory with a standard constructor (when indexing stdin)."),
                    new FlaggedOption("property", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'p',
                            "property",
                            "A 'key=value' specification, or the name of a property file (when indexing stdin).")
                                    .setAllowMultipleDeclarations(true),
                    new FlaggedOption("termProcessor", JSAP.STRING_PARSER, NullTermProcessor.class.getName(),
                            JSAP.NOT_REQUIRED, 't', "term-processor",
                            "Sets the term processor to the given class."),
                    new FlaggedOption("termMap", MG4JClassParser.getParser(),
                            ImmutableExternalPrefixMap.class.getName(), JSAP.NOT_REQUIRED, 'm', "term-map",
                            "Sets the term map class."),
                    new Switch("downcase", JSAP.NO_SHORTFLAG, "downcase",
                            "A shortcut for setting the term processor to the downcasing processor."),
                    new FlaggedOption("indexedField", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED,
                            'I', "indexed-field",
                            "The field(s) of the document factory that will be indexed. (default: all fields)")
                                    .setAllowMultipleDeclarations(true),
                    new Switch("allFields", 'a', "all-fields",
                            "Index also all virtual fields; has no effect if indexedField has been used at least once."),
                    new FlaggedOption("batchSize", JSAP.INTSIZE_PARSER,
                            Integer.toString(Scan.DEFAULT_BATCH_SIZE), JSAP.NOT_REQUIRED, 's', "batch-size",
                            "The maximum size of a batch, in documents. Batches will be smaller, however, if memory is exhausted."),
                    new FlaggedOption("maxTerms", JSAP.INTSIZE_PARSER, Integer.toString(Scan.DEFAULT_MAX_TERMS),
                            JSAP.NOT_REQUIRED, 'M', "max-terms",
                            "The maximum number of terms in a batch, in documents."),
                    new Switch("keepBatches", JSAP.NO_SHORTFLAG, "keep-batches",
                            "Do not delete intermediate batch files."),
                    new FlaggedOption("virtualDocumentResolver", JSAP.STRING_PARSER, JSAP.NO_DEFAULT,
                            JSAP.NOT_REQUIRED, 'v', "virtual-document-resolver",
                            "The virtual document resolver. It can be specified several times in the form [<field>:]<filename>. If the field is omitted, it sets the document resolver for all virtual fields.")
                                    .setAllowMultipleDeclarations(true),
                    new FlaggedOption("virtualDocumentGap", JSAP.STRING_PARSER, JSAP.NO_DEFAULT,
                            JSAP.NOT_REQUIRED, 'g', "virtual-document-gap",
                            "The virtual document gap. It can be specified several times in the form [<field>:]<gap>. If the field is omitted, it sets the document gap for all virtual fields; the default gap is "
                                    + Scan.DEFAULT_VIRTUAL_DOCUMENT_GAP).setAllowMultipleDeclarations(true),
                    new FlaggedOption("scanBufferSize", JSAP.INTSIZE_PARSER,
                            Util.formatBinarySize(Scan.DEFAULT_BUFFER_SIZE), JSAP.NOT_REQUIRED, 'b',
                            "scan-buffer-size", "The size of an I/O buffer for the scanning phase."),
                    new FlaggedOption("combineBufferSize", JSAP.INTSIZE_PARSER,
                            Util.formatBinarySize(Combine.DEFAULT_BUFFER_SIZE), JSAP.NOT_REQUIRED,
                            JSAP.NO_SHORTFLAG, "combine-buffer-size",
                            "The size of an I/O buffer for the combination phase."),
                    new FlaggedOption("pasteBufferSize", JSAP.INTSIZE_PARSER,
                            Util.formatBinarySize(Paste.DEFAULT_BUFFER_SIZE), JSAP.NOT_REQUIRED,
                            JSAP.NO_SHORTFLAG, "paste-buffer-size",
                            "The size of the internal temporary buffer used while pasting indices."),
                    new FlaggedOption("skipBufferSize", JSAP.INTSIZE_PARSER,
                            Util.formatBinarySize(SkipBitStreamIndexWriter.DEFAULT_TEMP_BUFFER_SIZE),
                            JSAP.NOT_REQUIRED, JSAP.NO_SHORTFLAG, "skip-buffer-size",
                            "The size of the internal temporary buffer used while creating an index with skips."),
                    new FlaggedOption("renumber", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'r',
                            "renumber", "The filename of a document renumbering."),
                    new FlaggedOption("zipCollection", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED,
                            'z', "zip",
                            "Creates a support ZipDocumentCollection with given basename (obsolete)."),
                    new FlaggedOption("buildCollection", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED,
                            'B', "build-collection",
                            "During the indexing phase, build a collection using this basename."),
                    new FlaggedOption("builderClass", MG4JClassParser.getParser(),
                            SimpleCompressedDocumentCollectionBuilder.class.getName(), JSAP.NOT_REQUIRED,
                            JSAP.NO_SHORTFLAG, "builder-class",
                            "Specifies a builder class for a document collection that will be created during the indexing phase."),
                    new Switch("exact", 'e', "exact",
                            "The builder class should be instantiated in its exact form, which records both words and nonwords."),
                    new FlaggedOption("comp", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'c',
                            "comp", "A compression flag for textual indices (may be specified several times).")
                                    .setAllowMultipleDeclarations(true),
                    new FlaggedOption("payloadComp", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED,
                            'C', "comp-payload",
                            "A compression flag for payload indices (may be specified several times).")
                                    .setAllowMultipleDeclarations(true),
                    new Switch("noSkips", JSAP.NO_SHORTFLAG, "no-skips", "Disables skips."),
                    new Switch("interleaved", JSAP.NO_SHORTFLAG, "interleaved", "Forces an interleaved index."),
                    new Switch("highPerformance", 'h', "high-performance", "Forces a high-performance index."),
                    new FlaggedOption("quantum", JSAP.INTEGER_PARSER,
                            Integer.toString(BitStreamIndex.DEFAULT_QUANTUM), JSAP.NOT_REQUIRED, 'Q', "quantum",
                            "For quasi-succinct indices, the size of the quantum (-1 implies the default quantum). For other indices, enable skips with given quantum, if positive; fix space occupancy of variable-quantum skip towers in percentage if negative."),
                    new FlaggedOption("height", JSAP.INTSIZE_PARSER,
                            Integer.toString(BitStreamIndex.DEFAULT_HEIGHT), JSAP.NOT_REQUIRED, 'H', "height",
                            "Enable skips with given height."),
                    new FlaggedOption("logInterval", JSAP.LONG_PARSER,
                            Long.toString(ProgressLogger.DEFAULT_LOG_INTERVAL), JSAP.NOT_REQUIRED, 'l',
                            "log-interval", "The minimum time interval between activity logs in milliseconds."),
                    new FlaggedOption("tempDir", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'T',
                            "temp-dir", "A directory for all temporary batch files."),
                    new UnflaggedOption("basename", JSAP.STRING_PARSER, JSAP.REQUIRED,
                            "The basename of the resulting index.") });

    JSAPResult jsapResult = jsap.parse(arg);
    if (jsap.messagePrinted())
        return;//from w  w  w.  j  a  v  a2 s.co m

    if ((jsapResult.userSpecified("builderClass") || jsapResult.userSpecified("exact"))
            && !jsapResult.userSpecified("buildCollection"))
        throw new IllegalArgumentException(
                "To specify options about the collection building process, you must specify a basename first.");
    if (jsapResult.userSpecified("sequence") && jsapResult.userSpecified("objectSequence"))
        throw new IllegalArgumentException(
                "You cannot specify both a serialised and an parseable-object sequence");

    final IOFactory ioFactory = Scan.parseIOFactory(jsapResult.getString("ioFactory"));

    final DocumentSequence documentSequence = jsapResult.userSpecified("objectSequence")
            ? (DocumentSequence) jsapResult.getObject("objectSequence")
            : Scan.getSequence(jsapResult.getString("sequence"), jsapResult.getClass("factory"),
                    jsapResult.getStringArray("property"), jsapResult.getInt("delimiter"), LOGGER);
    final DocumentFactory factory = documentSequence.factory();

    final int[] indexedField = Scan.parseFieldNames(jsapResult.getStringArray("indexedField"), factory,
            jsapResult.getBoolean("allFields"));
    final VirtualDocumentResolver[] virtualDocumentResolver = Scan.parseVirtualDocumentResolver(ioFactory,
            jsapResult.getStringArray("virtualDocumentResolver"), indexedField, factory);
    final int[] virtualDocumentGap = Scan
            .parseVirtualDocumentGap(jsapResult.getStringArray("virtualDocumentGap"), indexedField, factory);

    final TermProcessor termProcessor = jsapResult.getBoolean("downcase") ? DowncaseTermProcessor.getInstance()
            : ObjectParser.fromSpec(jsapResult.getString("termProcessor"), TermProcessor.class,
                    MG4JClassParser.PACKAGE, new String[] { "getInstance" });

    final boolean skips = !jsapResult.getBoolean("noSkips");
    final boolean interleaved = jsapResult.getBoolean("interleaved");
    final boolean highPerformance = jsapResult.getBoolean("highPerformance");
    if (interleaved && highPerformance)
        throw new IllegalArgumentException("You must specify either --interleaved or --high-performance.");
    if (!skips && !interleaved)
        throw new IllegalArgumentException("You can disable skips only for interleaved indices");
    if (!skips && (jsapResult.userSpecified("quantum") || jsapResult.userSpecified("height")))
        throw new IllegalArgumentException("You specified quantum or height, but you also disabled skips.");

    DocumentCollectionBuilder builder = null;
    if (jsapResult.userSpecified("buildCollection")) {
        final Class<? extends DocumentCollectionBuilder> builderClass = jsapResult.getClass("builderClass");
        try {
            // Try first IOFactory-based constructor.
            builder = builderClass != null ? builderClass
                    .getConstructor(IOFactory.class, String.class, DocumentFactory.class, boolean.class)
                    .newInstance(ioFactory, jsapResult.getString("buildCollection"),
                            documentSequence.factory().numberOfFields() == indexedField.length
                                    ? documentSequence.factory().copy()
                                    : new SubDocumentFactory(documentSequence.factory().copy(), indexedField),
                            Boolean.valueOf(jsapResult.getBoolean("exact")))
                    : null;
        } catch (NoSuchMethodException noIOFactoryConstructor) {
            builder = builderClass != null ? builderClass
                    .getConstructor(String.class, DocumentFactory.class, boolean.class)
                    .newInstance(jsapResult.getString("buildCollection"),
                            documentSequence.factory().numberOfFields() == indexedField.length
                                    ? documentSequence.factory().copy()
                                    : new SubDocumentFactory(documentSequence.factory().copy(), indexedField),
                            Boolean.valueOf(jsapResult.getBoolean("exact")))
                    : null;
            if (builder != null)
                LOGGER.warn(
                        "The builder class " + builderClass.getName() + " has no IOFactory-based constructor");
        }
    }

    final IndexBuilder indexBuilder = new IndexBuilder(jsapResult.getString("basename"), documentSequence)
            .ioFactory(ioFactory).termProcessor(termProcessor).builder(builder)
            .scanBufferSize(jsapResult.getInt("scanBufferSize"))
            .skipBufferSize(jsapResult.getInt("skipBufferSize"))
            .pasteBufferSize(jsapResult.getInt("pasteBufferSize"))
            .combineBufferSize(jsapResult.getInt("combineBufferSize"))
            .documentsPerBatch(jsapResult.getInt("batchSize")).maxTerms(jsapResult.getInt("maxTerms"))
            .keepBatches(jsapResult.getBoolean("keepBatches")).termMapClass(jsapResult.getClass("termMap"))
            .indexedFields(indexedField).skips(skips)
            .indexType(interleaved ? IndexType.INTERLEAVED
                    : highPerformance ? IndexType.HIGH_PERFORMANCE : IndexType.QUASI_SUCCINCT)
            .quantum(jsapResult.getInt("quantum")).height(jsapResult.getInt("height"))
            .logInterval(jsapResult.getLong("logInterval")).batchDirName(jsapResult.getString("tempDir"));

    for (int i = 0; i < virtualDocumentResolver.length; i++)
        if (virtualDocumentResolver[i] != null)
            indexBuilder.virtualDocumentResolvers.put(i, virtualDocumentResolver[i]);
    for (int i = 0; i < virtualDocumentGap.length; i++)
        indexBuilder.virtualDocumentGaps.put(i, virtualDocumentGap[i]);

    if (jsapResult.userSpecified("comp")) {
        if (interleaved || highPerformance)
            indexBuilder.standardWriterFlags(CompressionFlags.valueOf(jsapResult.getStringArray("comp"),
                    CompressionFlags.DEFAULT_STANDARD_INDEX));
        else
            indexBuilder.quasiSuccinctWriterFlags(CompressionFlags.valueOf(jsapResult.getStringArray("comp"),
                    CompressionFlags.DEFAULT_QUASI_SUCCINCT_INDEX));
    }
    if (jsapResult.userSpecified("compPayload"))
        indexBuilder.payloadWriterFlags(CompressionFlags.valueOf(jsapResult.getStringArray("compPayload"),
                CompressionFlags.DEFAULT_PAYLOAD_INDEX));
    if (jsapResult.userSpecified("renumber"))
        indexBuilder.mapFile(jsapResult.getString("renumber"));

    indexBuilder.run();
}

From source file:it.unimi.di.big.mg4j.tool.Scan.java

@SuppressWarnings("unchecked")
public static void main(final String[] arg)
        throws JSAPException, InvocationTargetException, NoSuchMethodException, ConfigurationException,
        ClassNotFoundException, IOException, IllegalAccessException, InstantiationException {

    SimpleJSAP jsap = new SimpleJSAP(Scan.class.getName(),
            "Builds a set of batches from a sequence of documents.",
            new Parameter[] {
                    new FlaggedOption("sequence", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'S',
                            "sequence", "A serialised document sequence that will be used instead of stdin."),
                    new FlaggedOption("ioFactory", JSAP.STRING_PARSER, "FILESYSTEM_FACTORY", JSAP.NOT_REQUIRED,
                            JSAP.NO_SHORTFLAG, "io-factory",
                            "An I/O factory that will be used to create files (either a static field of IOFactory or an object specification)."),
                    new FlaggedOption("objectSequence",
                            new ObjectParser(DocumentSequence.class, MG4JClassParser.PACKAGE), JSAP.NO_DEFAULT,
                            JSAP.NOT_REQUIRED, 'o', "object-sequence",
                            "An object specification describing a document sequence that will be used instead of stdin."),
                    new FlaggedOption("delimiter", JSAP.INTEGER_PARSER, Integer.toString(DEFAULT_DELIMITER),
                            JSAP.NOT_REQUIRED, 'd', "delimiter",
                            "The document delimiter (when indexing stdin)."),
                    new FlaggedOption("factory", MG4JClassParser.getParser(),
                            IdentityDocumentFactory.class.getName(), JSAP.NOT_REQUIRED, 'f', "factory",
                            "A document factory with a standard constructor (when indexing stdin)."),
                    new FlaggedOption("property", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'p',
                            "property",
                            "A 'key=value' specification, or the name of a property file (when indexing stdin).")
                                    .setAllowMultipleDeclarations(true),
                    new FlaggedOption("termProcessor", JSAP.STRING_PARSER, NullTermProcessor.class.getName(),
                            JSAP.NOT_REQUIRED, 't', "term-processor",
                            "Sets the term processor to the given class."),
                    new FlaggedOption("completeness", JSAP.STRING_PARSER, Completeness.POSITIONS.name(),
                            JSAP.NOT_REQUIRED, 'c', "completeness",
                            "How complete the index should be " + Arrays.toString(Completeness.values()) + "."),
                    new Switch("downcase", JSAP.NO_SHORTFLAG, "downcase",
                            "A shortcut for setting the term processor to the downcasing processor."),
                    new FlaggedOption("indexedField", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED,
                            'I', "indexed-field",
                            "The field(s) of the document factory that will be indexed. (default: all non-virtual fields)")
                                    .setAllowMultipleDeclarations(true),
                    new Switch("allFields", 'a', "all-fields",
                            "Index also all virtual fields; has no effect if indexedField has been used at least once."),
                    new FlaggedOption("buildCollection", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED,
                            'B', "build-collection",
                            "During the indexing phase, build a collection using this basename."),
                    new FlaggedOption("builderClass", MG4JClassParser.getParser(),
                            SimpleCompressedDocumentCollectionBuilder.class.getName(), JSAP.NOT_REQUIRED,
                            JSAP.NO_SHORTFLAG, "builder-class",
                            "Specifies a builder class for a document collection that will be created during the indexing phase."),
                    new Switch("exact", 'e', "exact",
                            "The builder class should be instantiated in its exact form, which records both words and nonwords."),
                    new FlaggedOption("batchSize", JSAP.INTSIZE_PARSER,
                            Integer.toString(Scan.DEFAULT_BATCH_SIZE), JSAP.NOT_REQUIRED, 's', "batch-size",
                            "The maximum size of a batch, in documents. Batches will be smaller, however, if memory is exhausted or there are too many terms."),
                    new FlaggedOption("maxTerms", JSAP.INTSIZE_PARSER, Integer.toString(Scan.DEFAULT_MAX_TERMS),
                            JSAP.NOT_REQUIRED, 'M', "max-terms",
                            "The maximum number of terms in a batch, in documents."),
                    new FlaggedOption("virtualDocumentResolver", JSAP.STRING_PARSER, JSAP.NO_DEFAULT,
                            JSAP.NOT_REQUIRED, 'v', "virtual-document-resolver",
                            "The virtual document resolver. It can be specified several times in the form [<field>:]<filename>. If the field is omitted, it sets the document resolver for all virtual fields.")
                                    .setAllowMultipleDeclarations(true),
                    new FlaggedOption("virtualDocumentGap", JSAP.STRING_PARSER, JSAP.NO_DEFAULT,
                            JSAP.NOT_REQUIRED, 'g', "virtual-document-gap",
                            "The virtual document gap. It can be specified several times in the form [<field>:]<gap>. If the field is omitted, it sets the document gap for all virtual fields; the default gap is "
                                    + DEFAULT_VIRTUAL_DOCUMENT_GAP).setAllowMultipleDeclarations(true),
                    new FlaggedOption("bufferSize", JSAP.INTSIZE_PARSER,
                            Util.formatBinarySize(DEFAULT_BUFFER_SIZE), JSAP.NOT_REQUIRED, 'b', "buffer-size",
                            "The size of an I/O buffer."),
                    new FlaggedOption("renumber", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'r',
                            "renumber", "The filename of a document renumbering."),
                    new Switch("keepUnsorted", 'u', "keep-unsorted", "Keep the unsorted term file."),
                    new FlaggedOption("logInterval", JSAP.LONG_PARSER,
                            Long.toString(ProgressLogger.DEFAULT_LOG_INTERVAL), JSAP.NOT_REQUIRED, 'l',
                            "log-interval", "The minimum time interval between activity logs in milliseconds."),
                    new FlaggedOption("tempDir", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'T',
                            "temp-dir", "A directory for all temporary files (e.g., batches)."),
                    new UnflaggedOption("basename", JSAP.STRING_PARSER, JSAP.REQUIRED,
                            "The basename of the resulting index.") });

    JSAPResult jsapResult = jsap.parse(arg);
    if (jsap.messagePrinted())
        return;//w w w  .  ja va2  s. c om

    if ((jsapResult.userSpecified("builderClass") || jsapResult.userSpecified("exact"))
            && !jsapResult.userSpecified("buildCollection"))
        throw new IllegalArgumentException(
                "To specify options about the collection building process, you must specify a basename first.");
    if (jsapResult.userSpecified("sequence") && jsapResult.userSpecified("objectSequence"))
        throw new IllegalArgumentException(
                "You cannot specify both a serialised and an parseable-object sequence");

    final DocumentSequence documentSequence = jsapResult.userSpecified("objectSequence")
            ? (DocumentSequence) jsapResult.getObject("objectSequence")
            : Scan.getSequence(jsapResult.getString("sequence"), jsapResult.getClass("factory"),
                    jsapResult.getStringArray("property"), jsapResult.getInt("delimiter"), LOGGER);

    final IOFactory ioFactory = parseIOFactory(jsapResult.getString("ioFactory"));

    final DocumentFactory factory = documentSequence.factory();
    final int[] indexedField = parseFieldNames(jsapResult.getStringArray("indexedField"), factory,
            jsapResult.getBoolean("allFields"));
    final int batchSize = jsapResult.getInt("batchSize");
    final VirtualDocumentResolver[] virtualDocumentResolver = parseVirtualDocumentResolver(ioFactory,
            jsapResult.getStringArray("virtualDocumentResolver"), indexedField, factory);
    final int[] virtualDocumentGap = parseVirtualDocumentGap(jsapResult.getStringArray("virtualDocumentGap"),
            indexedField, factory);

    DocumentCollectionBuilder builder = null;
    if (jsapResult.userSpecified("buildCollection")) {
        final Class<? extends DocumentCollectionBuilder> builderClass = jsapResult.getClass("builderClass");
        try {
            // Try first IOFactory-based constructor.
            builder = builderClass != null ? builderClass
                    .getConstructor(IOFactory.class, String.class, DocumentFactory.class, boolean.class)
                    .newInstance(ioFactory, jsapResult.getString("buildCollection"),
                            documentSequence.factory().numberOfFields() == indexedField.length
                                    ? documentSequence.factory().copy()
                                    : new SubDocumentFactory(documentSequence.factory().copy(), indexedField),
                            Boolean.valueOf(jsapResult.getBoolean("exact")))
                    : null;
        } catch (NoSuchMethodException noIOFactoryConstructor) {
            builder = builderClass != null ? builderClass
                    .getConstructor(String.class, DocumentFactory.class, boolean.class)
                    .newInstance(jsapResult.getString("buildCollection"),
                            documentSequence.factory().numberOfFields() == indexedField.length
                                    ? documentSequence.factory().copy()
                                    : new SubDocumentFactory(documentSequence.factory().copy(), indexedField),
                            Boolean.valueOf(jsapResult.getBoolean("exact")))
                    : null;
            if (builder != null)
                LOGGER.warn(
                        "The builder class " + builderClass.getName() + " has no IOFactory-based constructor");
        }
    }

    run(ioFactory, jsapResult.getString("basename"), documentSequence,
            Completeness.valueOf(jsapResult.getString("completeness")),
            jsapResult.getBoolean("downcase") ? DowncaseTermProcessor.getInstance()
                    : ObjectParser.fromSpec(jsapResult.getString("termProcessor"), TermProcessor.class,
                            MG4JClassParser.PACKAGE, new String[] { "getInstance" }),
            builder, jsapResult.getInt("bufferSize"), batchSize, jsapResult.getInt("maxTerms"), indexedField,
            virtualDocumentResolver, virtualDocumentGap, jsapResult.getString("renumber"),
            jsapResult.getLong("logInterval"), jsapResult.getString("tempDir"));
}

From source file:Main.java

public static String getFullClassName(Class c) {
    return c.getName();
}

From source file:Main.java

public static String getClassName(Class c) {
    String className = c.getName();
    int firstChar;
    firstChar = className.lastIndexOf('.') + 1;
    if (firstChar > 0) {
        className = className.substring(firstChar);
    }// ww w .  j ava2s.  c o  m
    return className;
}

From source file:Main.java

public static String getPackageName(Class c) {
    String fullyQualifiedName = c.getName();
    int lastDot = fullyQualifiedName.lastIndexOf('.');
    if (lastDot == -1) {
        return "";
    }//from   w w w . java 2  s  .com
    return fullyQualifiedName.substring(0, lastDot);
}

From source file:SampleCheckInterface.java

static void verifyInterface(Class c) {
    String name = c.getName();
    if (c.isInterface()) {
        System.out.println(name + " is an interface.");
    } else {//from  www . j av  a 2  s. c o m
        System.out.println(name + " is a class.");
    }
}

From source file:SampleName.java

static void printName(Object o) {
    Class c = o.getClass();
    String s = c.getName();
    System.out.println(s);
}

From source file:Main.java

public static String getClassName(Object obj) {
    Class c = obj.getClass();
    String className = c.getName();
    return className;
}

From source file:Main.java

public static String getClassName(Class<?> c) {
    return c.getName().substring(c.getName().lastIndexOf(".") + 1, c.getName().length());
}

From source file:Main.java

public static String getBasename(Class theClass) {
    return theClass.getName().replaceAll(".*\\.", "");
}