All files / src/Ice Identity.js

94.28% Statements 33/35
100% Branches 4/4
75% Functions 3/4
94.28% Lines 33/35

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 3641x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 4562x 4562x 4562x 41x 41x 3753x 3753x 3753x 41x 41x 3853x 3853x 3853x 41x 41x     41x 41x 41x 41x 41x  
// Copyright (c) ZeroC, Inc.
 
export const Ice = {};
 
/**
 *  The identity of an Ice object. In a proxy, an empty {@link Identity#name} denotes a nil proxy. An identity with
 *  an empty {@link Identity#name} and a non-empty {@link Identity#category} is illegal. You cannot add a servant
 *  with an empty name to the Active Servant Map.
 *  @see ServantLocator
 *  @see ObjectAdapter#addServantLocator
 */
Ice.Identity = class {
    constructor(name = "", category = "") {
        this.name = name;
        this.category = category;
    }
 
    _write(ostr) {
        ostr.writeString(this.name);
        ostr.writeString(this.category);
    }
 
    _read(istr) {
        this.name = istr.readString();
        this.category = istr.readString();
    }
 
    static get minWireSize() {
        return 2;
    }
};
 
// Moved to IdentityExtensions.js to avoid circular dependencies.
// Ice.defineStruct(Ice.Identity, true, true);
// Ice.IdentitySeqHelper = Ice.StreamHelpers.generateSeqHelper(Ice.Identity, false);