samedi 14 mai 2016

What dose the expression "m |= Modifier.PUBLIC" mean and why do things in that way?

When I learning reflection I found some snippet looks like that:

private static int modifierFromString(String s) {
    int m = 0x0;
    if ("public".equals(s))           m |= Modifier.PUBLIC;
    else if ("protected".equals(s))   m |= Modifier.PROTECTED;
    else if ("private".equals(s))     m |= Modifier.PRIVATE;
    else if ("static".equals(s))      m |= Modifier.STATIC;
    else if ("final".equals(s))       m |= Modifier.FINAL;
    else if ("transient".equals(s))   m |= Modifier.TRANSIENT;
    else if ("volatile".equals(s))    m |= Modifier.VOLATILE;
    return m;
}

I am very confused,what dose the "m |= Modifier.PUBLIC" mean and can I use "m = Modifier.PUBLIC"?





Aucun commentaire:

Enregistrer un commentaire