本文整理匯總了Java中java.lang.reflect.Modifier.INTERFACE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Modifier.INTERFACE屬性的具體用法?Java Modifier.INTERFACE怎麽用?Java Modifier.INTERFACE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.lang.reflect.Modifier
的用法示例。
在下文中一共展示了Modifier.INTERFACE屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: analyzeImplementation
private void analyzeImplementation(final TypeLiteral<?> type, boolean ignoreConstructor)
{
if( !scannedTypes.contains(type) )
{
try
{
if( (type.getRawType().getModifiers() & (Modifier.INTERFACE | Modifier.ABSTRACT)) == 0 )
{
analyzeInjectionPoints(InjectionPoint.forInstanceMethodsAndFields(type));
if( !ignoreConstructor )
{
analyzeDependencies(InjectionPoint.forConstructorOf(type).getDependencies());
}
}
}
catch( ConfigurationException ce )
{
errors.merge(ce.getErrorMessages());
}
scannedTypes.add(type);
}
}
示例2: getSuperclass
@MethodSubstitution(isStatic = false)
public static Class<?> getSuperclass(final Class<?> thisObj) {
KlassPointer klass = ClassGetHubNode.readClass(thisObj);
if (!klass.isNull()) {
KlassPointer klassNonNull = ClassGetHubNode.piCastNonNull(klass, SnippetAnchorNode.anchor());
int accessFlags = klassNonNull.readInt(klassAccessFlagsOffset(INJECTED_VMCONFIG), KLASS_ACCESS_FLAGS_LOCATION);
if ((accessFlags & Modifier.INTERFACE) == 0) {
if (klassIsArray(klassNonNull)) {
return Object.class;
} else {
KlassPointer superKlass = klassNonNull.readKlassPointer(klassSuperKlassOffset(INJECTED_VMCONFIG), KLASS_SUPER_KLASS_LOCATION);
if (superKlass.isNull()) {
return null;
} else {
KlassPointer superKlassNonNull = ClassGetHubNode.piCastNonNull(superKlass, SnippetAnchorNode.anchor());
return HubGetClassNode.readClass(superKlassNonNull);
}
}
}
} else {
// Class for primitive type
}
return null;
}
示例3: main
public static void main(String [] argv) {
int allMods = Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE |
Modifier.ABSTRACT | Modifier.STATIC | Modifier.FINAL |
Modifier.TRANSIENT | Modifier.VOLATILE | Modifier.SYNCHRONIZED |
Modifier.NATIVE | Modifier.STRICT | Modifier.INTERFACE;
String allModsString = "public protected private abstract static " +
"final transient volatile synchronized native strictfp interface";
/* zero should have an empty string */
testString(0, "");
/* test to make sure all modifiers print out in the proper order */
testString(allMods, allModsString);
/* verify no extraneous modifiers are printed */
testString(~0, allModsString);
}
示例4: translateModifiers
/**
* Convert modifier bits from private coding used by
* the compiler to that of java.lang.reflect.Modifier.
*/
static int translateModifiers(long flags) {
int result = 0;
if ((flags & Flags.ABSTRACT) != 0)
result |= Modifier.ABSTRACT;
if ((flags & Flags.FINAL) != 0)
result |= Modifier.FINAL;
if ((flags & Flags.INTERFACE) != 0)
result |= Modifier.INTERFACE;
if ((flags & Flags.NATIVE) != 0)
result |= Modifier.NATIVE;
if ((flags & Flags.PRIVATE) != 0)
result |= Modifier.PRIVATE;
if ((flags & Flags.PROTECTED) != 0)
result |= Modifier.PROTECTED;
if ((flags & Flags.PUBLIC) != 0)
result |= Modifier.PUBLIC;
if ((flags & Flags.STATIC) != 0)
result |= Modifier.STATIC;
if ((flags & Flags.SYNCHRONIZED) != 0)
result |= Modifier.SYNCHRONIZED;
if ((flags & Flags.TRANSIENT) != 0)
result |= Modifier.TRANSIENT;
if ((flags & Flags.VOLATILE) != 0)
result |= Modifier.VOLATILE;
return result;
}
示例5: isInterface
@MethodSubstitution(isStatic = false)
public static boolean isInterface(final Class<?> thisObj) {
KlassPointer klass = ClassGetHubNode.readClass(thisObj);
if (klass.isNull()) {
// Class for primitive type
return false;
} else {
int accessFlags = klass.readInt(klassAccessFlagsOffset(INJECTED_VMCONFIG), KLASS_ACCESS_FLAGS_LOCATION);
return (accessFlags & Modifier.INTERFACE) != 0;
}
}
示例6: computeDefaultSUID
/**
* 計算默認的 serialVersionUID
*
* @see java.io.ObjectStreamClass#lookup(Class)
* @see java.io.ObjectStreamClass#computeDefaultSUID(Class)
*/
public static long computeDefaultSUID(String className, List<Field> fields) {
try {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
DataOutputStream dout = new DataOutputStream(bout);
// simple class name
dout.writeUTF(className);
int classMods = Modifier.PUBLIC & (Modifier.PUBLIC | Modifier.FINAL | Modifier.INTERFACE | Modifier.ABSTRACT);
dout.writeInt(classMods);
// interface name
dout.writeUTF("java.io.Serializable");
// fields
// fields.sort(Comparator.comparing(Field::getField));
for (Field field : fields) {
int mods = Modifier.PRIVATE &
(Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED |
Modifier.STATIC | Modifier.FINAL | Modifier.VOLATILE |
Modifier.TRANSIENT);
if (((mods & Modifier.PRIVATE) == 0) ||
((mods & (Modifier.STATIC | Modifier.TRANSIENT)) == 0)) {
dout.writeUTF(field.getField());
dout.writeInt(mods);
dout.writeUTF(field.getFieldType());
}
}
// method ignore
dout.flush();
MessageDigest md = MessageDigest.getInstance("SHA");
byte[] hashBytes = md.digest(bout.toByteArray());
long hash = 0;
for (int i = Math.min(hashBytes.length, 8) - 1; i >= 0; i--) {
hash = (hash << 8) | (hashBytes[i] & 0xFF);
}
return hash;
} catch (Exception e) {
// ignore
}
return 1;
}
示例7: renderModifiers
protected String renderModifiers( StringBuilder sb, long modifiers, boolean isDefault, int defModifier )
{
if( isDefault )
{
sb.append( "default " );
}
if( (modifiers & Modifier.PUBLIC) != 0 )
{
sb.append( "public " );
}
else if( (modifiers & Modifier.PROTECTED) != 0 )
{
sb.append( "protected " );
}
else if( (modifiers & Modifier.PRIVATE) != 0 )
{
sb.append( "private " );
}
else if( defModifier != 0 )
{
renderModifiers( sb, defModifier, false, 0 );
}
// Canonical order
if( (modifiers & Modifier.ABSTRACT) != 0 )
{
sb.append( "abstract " );
}
if( (modifiers & Modifier.STATIC) != 0 )
{
sb.append( "static " );
}
if( (modifiers & Modifier.FINAL) != 0 )
{
sb.append( "final " );
}
if( (modifiers & Modifier.TRANSIENT) != 0 )
{
sb.append( "transient " );
}
if( (modifiers & Modifier.VOLATILE) != 0 )
{
sb.append( "volatile " );
}
if( (modifiers & Modifier.SYNCHRONIZED) != 0 )
{
sb.append( "synchronized " );
}
if( (modifiers & Modifier.INTERFACE) != 0 )
{
sb.append( "interface " );
}
return "";
}