Search in sources :

Example 1 with ValueMemberAnalysis

use of org.wildfly.iiop.openjdk.rmi.ValueMemberAnalysis in project wildfly by wildfly.

the class InterfaceRepository method addValue.

/**
     * Add a value type.
     */
private ValueDefImpl addValue(ValueAnalysis va) throws RMIIIOPViolationException, IRConstructionException {
    ValueDefImpl vDef;
    Class cls = va.getCls();
    // Lookup: Has it already been added?
    vDef = (ValueDefImpl) valueMap.get(cls);
    if (vDef != null)
        // Yes, just return it.
        return vDef;
    // Get module to add value to.
    ModuleDefImpl m = ensurePackageExists(cls.getPackage().getName());
    // Add implemented interfaces
    String[] supported_interfaces = addInterfaces(va);
    // Add abstract base valuetypes
    String[] abstract_base_valuetypes = addAbstractBaseValuetypes(va);
    // Add superclass
    ValueDefImpl superValue = null;
    ValueAnalysis superAnalysis = va.getSuperAnalysis();
    if (superAnalysis != null)
        superValue = addValue(superAnalysis);
    // Create the value
    String base = cls.getName();
    base = base.substring(base.lastIndexOf('.') + 1);
    base = Util.javaToIDLName(base);
    TypeCode baseTypeCode;
    if (superValue == null)
        baseTypeCode = orb.get_primitive_tc(TCKind.tk_null);
    else
        baseTypeCode = superValue.type();
    vDef = new ValueDefImpl(va.getRepositoryId(), base, "1.0", m, va.isAbstractValue(), va.isCustom(), supported_interfaces, abstract_base_valuetypes, baseTypeCode, impl);
    addTypeCode(cls, vDef.type());
    m.add(base, vDef);
    // Remember we mapped this.
    valueMap.put(cls, vDef);
    // Fill in constants.
    addConstants(vDef, va);
    // Add value members
    ValueMemberAnalysis[] vmas = va.getMembers();
    for (int i = 0; i < vmas.length; ++i) {
        ValueMemberDefImpl vmDef;
        String vmid = va.getMemberRepositoryId(vmas[i].getJavaName());
        String vmName = vmas[i].getIDLName();
        Class vmCls = vmas[i].getCls();
        TypeCode typeCode = getTypeCode(vmCls);
        boolean vmPublic = vmas[i].isPublic();
        vmDef = new ValueMemberDefImpl(vmid, vmName, "1.0", typeCode, vmPublic, vDef, impl);
        vDef.add(vmName, vmDef);
    }
    // Add attributes
    addAttributes(vDef, va);
    return vDef;
}
Also used : TypeCode(org.omg.CORBA.TypeCode) ValueAnalysis(org.wildfly.iiop.openjdk.rmi.ValueAnalysis) ValueMemberAnalysis(org.wildfly.iiop.openjdk.rmi.ValueMemberAnalysis)

Aggregations

TypeCode (org.omg.CORBA.TypeCode)1 ValueAnalysis (org.wildfly.iiop.openjdk.rmi.ValueAnalysis)1 ValueMemberAnalysis (org.wildfly.iiop.openjdk.rmi.ValueMemberAnalysis)1