PropertiesBindingImpl.java :  » XML » X2JB » com » x2jb » bind » provider » Java Open Source

Java Open Source » XML » X2JB 
X2JB » com » x2jb » bind » provider » PropertiesBindingImpl.java
/*
 * XML 2 Java Binding (X2JB) - the excellent Java tool.
 * Copyright 2007, by Richard Opalka.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not see the FSF site:
 * http://www.fsf.org/ and search for the LGPL License document there.
 */
package com.x2jb.bind.provider;

import org.x2jb.bind.provider.BindingDefinition;
import org.x2jb.bind.BindingException;

/**
 * Binding implementation for Java resource bundles
 *
 * @author <a href="mailto:richard_opalka@yahoo.com">Richard Opalka</a>
 * @version 1.0
 */
final class PropertiesBindingImpl implements BindingDefinition {

    private final String nodeNamespace;
    private final String nodeName;
    private final boolean isElementNode;
    private final boolean isNodeMandatory;
    private final boolean isNodeUnique;
    private final String typeHandler;
  
    PropertiesBindingImpl( String namespace, String name, boolean isElement, boolean isMandatory, boolean isUnique, String handler ) {
        this.nodeNamespace = namespace;
        this.nodeName = name;
        this.isElementNode = isElement;
        this.isNodeMandatory = isMandatory;
        this.typeHandler = handler;
        this.isNodeUnique = isUnique;
    }

    public final String getNodeNamespace() throws BindingException {
        return this.nodeNamespace;
    }

    public final String getNodeName() throws BindingException {
        return this.nodeName;
    }

    public final boolean isElementNode() throws BindingException {
        return this.isElementNode;
    }

    public final boolean isNodeMandatory() throws BindingException {
        return this.isNodeMandatory;
    }

    public final boolean isNodeUnique() throws BindingException {
        return this.isNodeUnique;
    }

    public final Class getTypeHandler() throws BindingException {
        if ( this.typeHandler == null ) return null;
        
        try {
            return Class.forName( this.typeHandler );
        } catch ( ClassNotFoundException cnfe ) {
            throw new BindingException( cnfe.getMessage(), cnfe );
        }
    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.