public static int fromModifierSet ( Set < Modifier > set ) { int modifiers = 0 ; if ( set . contains ( Modifier . PUBLIC ) ) { modifiers |= java . lang . reflect . Modifier . PUBLIC ; } if ( set . contains ( Modifier . PRIVATE ) ) { modifiers |= java . lang . reflect . Modifier . PRIVATE ; } if ( set . contains ( Modifier . PROTECTED ) ) { modifiers |= java . lang . reflect . Modifier . PROTECTED ; } if ( set . contains ( Modifier . STATIC ) ) { modifiers |= java . lang . reflect . Modifier . STATIC ; } if ( set . contains ( Modifier . FINAL ) ) { modifiers |= java . lang . reflect . Modifier . FINAL ; } if ( set . contains ( Modifier . SYNCHRONIZED ) ) { modifiers |= java . lang . reflect . Modifier . SYNCHRONIZED ; } if ( set . contains ( Modifier . VOLATILE ) ) { modifiers |= java . lang . reflect . Modifier . VOLATILE ; } if ( set . contains ( Modifier . TRANSIENT ) ) { modifiers |= java . lang . reflect . Modifier . TRANSIENT ; } if ( set . contains ( Modifier . NATIVE ) ) { modifiers |= java . lang . reflect . Modifier . NATIVE ; } if ( set . contains ( Modifier . ABSTRACT ) ) { modifiers |= java . lang . reflect . Modifier . ABSTRACT ; } if ( set . contains ( Modifier . STRICTFP ) ) { modifiers |= java . lang . reflect . Modifier . STRICT ; } return modifiers ; }
This conversion is lossy because there is no bit for default the JVM spec .