SquirrelJME/SquirrelJME

View on GitHub
modules/tool-classfile/src/main/java/net/multiphasicapps/classfile/MemberFlags.java

Summary

Maintainability
A
0 mins
Test Coverage
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the Mozilla Public License Version 2.0.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.classfile;

/**
 * This is the base class for flags which are for member types.
 *
 * @param <F> The flag type.
 * @since 2016/04/23
 */
public abstract class MemberFlags<F extends MemberFlag>
    extends Flags<F>
    implements AccessibleFlags
{
    /**
     * Initializes the member flags.
     *
     * @param __cl The required class type.
     * @param __fl The flags used.
     * @since 2016/04/23
     */
    MemberFlags(Class<F> __cl, F[] __fl)
    {
        super(__cl, __fl);
    }
    
    /**
     * Initializes the member flags.
     *
     * @param __cl The required class type.
     * @param __fl The flags used.
     * @since 2016/04/23
     */
    MemberFlags(Class<F> __cl, Iterable<F> __fl)
    {
        super(__cl, __fl);
    }
    
    /**
     * Returns {@code true} if this is final.
     *
     * @return {@code true} if final.
     * @since 2016/03/20
     */
    public abstract boolean isFinal();
    
    /**
     * {@inheritDoc}
     * @since 2016/03/20
     */
    @Override
    public abstract boolean isPrivate();
    
    /**
     * {@inheritDoc}
     * @since 2016/03/20
     */
    @Override
    public abstract boolean isProtected();
    
    /**
     * {@inheritDoc}
     * @since 2016/03/20
     */
    @Override
    public abstract boolean isPublic();
    
    /**
     * Returns {@code true} if this is static.
     *
     * @return {@code true} if static.
     * @since 2016/03/20
     */
    public abstract boolean isStatic();
    
    /**
     * Returns {@code true} if this is synthetic.
     *
     * @return {@code true} if synthetic.
     * @since 2016/03/20
     */
    public abstract boolean isSynthetic();
    
    /**
     * Is this not static?
     *
     * @return If this is not static.
     * @since 2018/09/09
     */
    public final boolean isInstance()
    {
        return !this.isStatic();
    }
    
    /**
     * {@inheritDoc}
     * @since 2016/03/20
     */
    @Override
    public final boolean isPackagePrivate()
    {
        return !this.isPublic() && !this.isProtected() && !this.isPrivate();
    }
}