com.thoughtworks.qdox.model.impl.AbstractJavaEntity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of qdox Show documentation
Show all versions of qdox Show documentation
QDox is a high speed, small footprint parser for extracting class/interface/method definitions from source files
complete with JavaDoc @tags. It is designed to be used by active code generators or documentation tools.
package com.thoughtworks.qdox.model.impl;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.util.Collections;
import java.util.List;
import com.thoughtworks.qdox.model.JavaClass;
import com.thoughtworks.qdox.model.JavaModel;
public abstract class AbstractJavaEntity extends AbstractBaseJavaEntity implements JavaModel {
private List modifiers = Collections.emptyList();
private JavaClass declaringClass;
private String name;
/**
* Return list of modifiers as Strings.
* (public, private, protected, final, abstract, static)
* @return a list of modifiers, never null
*/
public List getModifiers() {
return modifiers;
}
public void setModifiers(List modifiers) {
this.modifiers = modifiers;
}
/**
* Equivalent of {@link java.lang.reflect.Modifier#isAbstract(int)}
*
* @return true
if entity is abstract, otherwise false
*/
public boolean isAbstract() {
return isModifierPresent("abstract");
}
/**
* Equivalent of {@link java.lang.reflect.Modifier#isPublic(int)}
*
* @return true
if entity is public, otherwise false
*/
public boolean isPublic() {
return isModifierPresent("public");
}
/**
* Equivalent of {@link java.lang.reflect.Modifier#isPrivate(int)}
*
* @return true
if entity is private, otherwise false
*/
public boolean isPrivate() {
return isModifierPresent("private");
}
/**
* Equivalent of {@link java.lang.reflect.Modifier#isProtected(int)}
*
* @return true
if entity is protected, otherwise false
*/
public boolean isProtected() {
return isModifierPresent("protected");
}
/**
* Equivalent of {@link java.lang.reflect.Modifier#isStatic(int)}
*
* @return true
if entity is static, otherwise false
*/
public boolean isStatic() {
return isModifierPresent("static");
}
/**
* Equivalent of {@link java.lang.reflect.Modifier#isFinal(int)}
*
* @return true
if entity is final, otherwise false
*/
public boolean isFinal() {
return isModifierPresent("final");
}
/**
* Equivalent of {@link java.lang.reflect.Modifier#isSynchronized(int)}
*
* @return true
if entity is sunchronized, otherwise false
*/
public boolean isSynchronized() {
return isModifierPresent("synchronized");
}
/**
* Equivalent of {@link java.lang.reflect.Modifier#isTransient(int)}
*
* @return true
if entity is transient, otherwise false
*/
public boolean isTransient() {
return isModifierPresent("transient");
}
/**
* Equivalent of {@link java.lang.reflect.Modifier#isVolatile(int)}
*
* @return true
if entity is volatile, otherwise false
* @since 1.4
*/
public boolean isVolatile() {
return isModifierPresent("volatile");
}
/**
* Equivalent of {@link java.lang.reflect.Modifier#isNative(int)}
*
* @return true
if entity is native, otherwise false
* @since 1.4
*/
public boolean isNative() {
return isModifierPresent("native");
}
/**
* Equivalent of {@link java.lang.reflect.Modifier#isStrict(int)}
*
* @return true
if entity is strictfp, otherwise false
* @since 1.4
*/
public boolean isStrictfp() {
return isModifierPresent("strictfp");
}
/**
* Returns true
if one of the modifiers matches the {@code modifier}
*
* @param modifier the modifier
* @return true
if the modifier is present, otherwise false
*/
private boolean isModifierPresent(String modifier) {
return modifiers.contains(modifier);
}
public void setDeclaringClass( JavaClass declaringClass )
{
this.declaringClass = declaringClass;
}
/** {@inheritDoc} */
public JavaClass getDeclaringClass()
{
return declaringClass;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}