package jetbrains.mps.baseLanguage.javastub.asm;
/*Generated by MPS */
import org.jetbrains.org.objectweb.asm.tree.FieldNode;
import java.util.List;
import java.util.ArrayList;
import org.jetbrains.org.objectweb.asm.tree.AnnotationNode;
import org.jetbrains.org.objectweb.asm.Opcodes;
import java.util.Collections;
public class ASMField {
private FieldNode myField;
private List<ASMAnnotation> myAnnotations;
private ASMType myType;
private ASMType myGenericType;
/*package*/ ASMField(FieldNode field) {
myField = field;
if (myField.visibleAnnotations != null) {
myAnnotations = new ArrayList<ASMAnnotation>(myField.visibleAnnotations.size());
for (AnnotationNode an : (List<AnnotationNode>) myField.visibleAnnotations) {
ASMAnnotation aa = new ASMAnnotation(an);
myAnnotations.add(aa);
}
}
myType = TypeUtil.fromDescriptor(myField.desc);
if (myField.signature != null) {
myGenericType = TypeUtil.getFieldType(myField.signature);
} else {
myGenericType = myType;
}
}
public String getName() {
return myField.name;
}
public boolean isPrivate() {
return (Opcodes.ACC_PRIVATE & myField.access) != 0;
}
public boolean isPublic() {
return (Opcodes.ACC_PUBLIC & myField.access) != 0;
}
public boolean isProtected() {
return (Opcodes.ACC_PROTECTED & myField.access) != 0;
}
public boolean isDeprecated() {
return (Opcodes.ACC_DEPRECATED & myField.access) != 0;
}
public boolean isPackageProtected() {
return !(isPublic()) && !(isPrivate()) && !(isProtected());
}
public boolean isStatic() {
return (Opcodes.ACC_STATIC & myField.access) != 0;
}
public boolean isFinal() {
return (Opcodes.ACC_FINAL & myField.access) != 0;
}
public boolean isEnumConstant() {
return (Opcodes.ACC_ENUM & myField.access) != 0;
}
public boolean isCompilerGenerated() {
return myField.name.equals("$assertionsDisabled");
}
public boolean hasValue() {
return null != myField.value;
}
public Object getValue() {
return myField.value;
}
public ASMType getType() {
return myType;
}
public ASMType getGenericType() {
return myGenericType;
}
public List<ASMAnnotation> getAnnotations() {
return ((List<ASMAnnotation>) ((myAnnotations == null ? Collections.emptyList() : Collections.unmodifiableList(myAnnotations))));
}
}