Package org.apache.commons.betwixt

Examples of org.apache.commons.betwixt.Options


        if ( beanInfo != null ) {
            ElementDescriptor elementDescriptor = beanInfo.getElementDescriptor();
            if ( elementDescriptor != null ) {
               
                // Construct the options
                Options combinedOptions = new Options();

                // Add options defined by the current bean's element descriptor
                combinedOptions.addOptions(elementDescriptor.getOptions());
               
                // The parent descriptor may have defined options
                // for the current bean.  These options take precedence
                // over the options of the current class descriptor
                if( context.getOptions() != null) {
                    combinedOptions.addOptions(context.getOptions());
                }
                context = context.newContext( bean );
                context.pushOptions(combinedOptions);
               
                if ( qualifiedName == null ) {
View Full Code Here


     * Gets the current flavour from the context.
     * @param context <code>Context</code>, not null
     */
    private String getFlavour(Context context) {
        String flavour = null;
        Options options = context.getOptions();
        if (options != null) {
            flavour = options.getValue(FLAVOUR_OPTION_NAME);
        }
        return flavour;
    }
View Full Code Here

            if (currentDescriptor != null) {
                nextDescriptor = currentDescriptor.getElementDescriptor(elementName);
            }
        }
        Updater updater = null;
        Options options = null;
        if (nextDescriptor != null) {
            updater = nextDescriptor.getUpdater();
            options = nextDescriptor.getOptions();
        }
        updaterStack.push(updater);
View Full Code Here

     * @return <code>Options</code> that currently apply
     * or null if there are no current options.
     * @since 0.7
     */
    public Options getOptions() {
        Options results = null;
        if (!optionStack.isEmpty()) {
            results = (Options) optionStack.peek();
        }
        return results;
    }
View Full Code Here

     */
    public String getInheritedOption(String name) {
        String result = null;
        for (int i=0; i<optionStack.size() ; i++)
        {
            Options options = (Options) optionStack.peek(i);
            if (options != null)
            {
                result = options.getValue(name);
                if (result != null)
                {
                    break;
                }
            }
View Full Code Here

public class TestContext extends TestCase {

    public void testOptions() throws Exception {
        Context context = new Context();
        assertNull(context.getOptions());
        Options firstOptions = new Options();
        context.pushOptions(firstOptions);
        assertEquals(firstOptions, context.getOptions());
        Options secondOptions = new Options();
        context.pushOptions(secondOptions);
        assertEquals(secondOptions, context.getOptions());
        context.popOptions();
        assertEquals(firstOptions, context.getOptions());
        context.popOptions();
View Full Code Here

    private static final String BETA = "BETA";
    private static final String GAMMA = "GAMMA";
   
    public void testOptionInheritance() throws Exception {
       
        Options optionsAlpha = new Options();
        optionsAlpha.addOption(OPTION_NAME_TWO, ALPHA);
        optionsAlpha.addOption(OPTION_NAME_THREE, ALPHA);
        optionsAlpha.addOption(OPTION_NAME_FOUR, ALPHA);
        Options optionsBeta = new Options();
        optionsBeta.addOption(OPTION_NAME_TWO, BETA);
        optionsBeta.addOption(OPTION_NAME_THREE, BETA);
        Options optionsGamma = new Options();
        optionsGamma.addOption(OPTION_NAME_TWO, GAMMA);
       
        Context context = new Context();
        context.pushOptions(optionsAlpha);
        context.pushOptions(optionsBeta);
        context.pushOptions(optionsGamma);
View Full Code Here

     * Gets the current flavour from the context.
     * @param context <code>Context</code>, not null
     */
    private String getFlavour(Context context) {
        String flavour = null;
        Options options = context.getOptions();
        if (options != null) {
            flavour = options.getValue(FLAVOUR_OPTION_NAME);
        }
        return flavour;
    }
View Full Code Here

public class TestContext extends TestCase {

    public void testOptions() throws Exception {
        Context context = new Context();
        assertNull(context.getOptions());
        Options firstOptions = new Options();
        context.pushOptions(firstOptions);
        assertEquals(firstOptions, context.getOptions());
        Options secondOptions = new Options();
        context.pushOptions(secondOptions);
        assertEquals(secondOptions, context.getOptions());
        context.popOptions();
        assertEquals(firstOptions, context.getOptions());
        context.popOptions();
View Full Code Here

     * @return <code>Options</code> that currently apply
     * or null if there are no current options.
     * @since 0.7
     */
    public Options getOptions() {
        Options results = null;
        if (!optionStack.isEmpty()) {
            results = (Options) optionStack.peek();
        }
        return results;
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.betwixt.Options

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.