All Downloads are FREE. Search and download functionalities are using the official Maven repository.

me.tomassetti.symbolsolver.model.declarations.Declaration Maven / Gradle / Ivy

There is a newer version: 0.3.1
Show newest version
package me.tomassetti.symbolsolver.model.declarations;

/**
 * A generic declaration.
 *
 * @author Federico Tomassetti
 */
public interface Declaration {

    /**
     * Anonymous classes do not have a name, for example.
     */
    default boolean hasName() {
        return true;
    }

    /**
     * Should return the name or throw a RuntimeException if the name is not available.
     */
    String getName();

    default boolean isField() {
        return false;
    }

    default boolean isParameter() {
        return false;
    }

    default boolean isVariable() {
        return false;
    }

    default boolean isType() {
        return false;
    }

    default boolean isMethod() {
        return false;
    }

    default FieldDeclaration asField() {
        throw new UnsupportedOperationException();
    }

    default ParameterDeclaration asParameter() {
        throw new UnsupportedOperationException();
    }

    default TypeDeclaration asType() {
        throw new UnsupportedOperationException();
    }

    default MethodDeclaration asMethod() {
        throw new UnsupportedOperationException();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy