All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.evolvedbinary.appbundler.Option Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
/*
 * Much of this code was originally taken from Oracle's
 * App Bundler class com.oracle.appbundler.Option
 * and some modifications made by Adam Retter.
 * The original copyright and license follows...
 */

/*
 * Copyright 2012, Oracle and/or its affiliates. All rights reserved.
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */
package com.evolvedbinary.appbundler;

import com.oracle.appbundler.AppBundlerTask;
import org.apache.maven.plugins.annotations.Parameter;

/**
 * Class representing an option that will be passed to the JVM at startup.
 * The class can optionally be named, which allows the bundled Java program
 * itself to override the option. Changes will take effect upon restart of the
 * application.

* Assuming your {@code CFBundleIdentifier} (settable via {@link AppBundlerTask#setIdentifier(String)}) * is {@code com.oracle.appbundler}. Then you can override a named option by calling *

 *     import java.util.prefs.Preferences;
 *     [...]
 *     Preferences jvmOptions = Preferences.userRoot().node("/com/oracle/appbundler/JVMOptions");
 *     jvmOptions.put("name", "value");
 *     jvmOptions.flush();
 * 
* The corresponding entries will be stored in a file called * {@code ~/Library/Preferences/com.oracle.appbundler.plist}. * To manipulate the file without Java's {@link java.util.prefs.Preferences} from the command line, * you should use the tool * defaults. * For example, to add an entry via the command line, use: *
 *     defaults write com.oracle.appbundler /com/oracle/appbundler/ -dict-add JVMOptions/ '{"name"="value";}'
 * 
* * @author Hendrik Schreiber (preference related code only) */ public class Option { @Parameter private String value = null; @Parameter private String name = null; public String getValue() { return value; } public void setValue(final String value) { this.value = value; } public void set(final String value) { this.name = null; this.value = value; } public String getName() { return name; } public void setName(final String name) { this.name = name; } @Override public String toString() { return name == null ? value : name + "=" + value; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy