2 * Copyright (C) 2007 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.dexgen.rop;
19 import com.android.dexgen.rop.cst.CstNat;
20 import com.android.dexgen.rop.cst.CstType;
21 import com.android.dexgen.rop.cst.TypedConstant;
24 * Standard implementation of {@link Field}, which directly stores
25 * all the associated data.
27 public final class StdField extends StdMember implements Field {
29 * Constructs an instance.
31 * @param definingClass {@code non-null;} the defining class
32 * @param accessFlags access flags
33 * @param nat {@code non-null;} member name and type (descriptor)
34 * @param attributes {@code non-null;} list of associated attributes
36 public StdField(CstType definingClass, int accessFlags, CstNat nat,
37 AttributeList attributes) {
38 super(definingClass, accessFlags, nat, attributes);
42 public TypedConstant getConstantValue() {
43 AttributeList attribs = getAttributes();
44 AttConstantValue cval = (AttConstantValue)
45 attribs.findFirst(AttConstantValue.ATTRIBUTE_NAME);
51 return cval.getConstantValue();