JField.java 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. package org.apache.jute.compiler;
  19. /**
  20. *
  21. */
  22. public class JField {
  23. private JType mType;
  24. private String mName;
  25. /**
  26. * Creates a new instance of JField
  27. */
  28. public JField(JType type, String name) {
  29. mType = type;
  30. mName = name;
  31. }
  32. public String getSignature() {
  33. return mType.getSignature();
  34. }
  35. public String genCppDecl() {
  36. return mType.genCppDecl(mName);
  37. }
  38. public String genCDecl() {
  39. return mType.genCDecl(mName);
  40. }
  41. public String genJavaDecl() {
  42. return mType.genJavaDecl(mName);
  43. }
  44. public String genJavaConstructorParam(String fname) {
  45. return mType.genJavaConstructorParam(fname);
  46. }
  47. public String getName() {
  48. return mName;
  49. }
  50. public String getTag() {
  51. return mName;
  52. }
  53. public JType getType() {
  54. return mType;
  55. }
  56. public String genCppGetSet(int fIdx) {
  57. return mType.genCppGetSet(mName, fIdx);
  58. }
  59. public String genJavaGetSet(int fIdx) {
  60. return mType.genJavaGetSet(mName, fIdx);
  61. }
  62. public String genJavaWriteMethodName() {
  63. return mType.genJavaWriteMethod(getName(), getTag());
  64. }
  65. public String genJavaReadMethodName() {
  66. return mType.genJavaReadMethod(getName(), getTag());
  67. }
  68. public String genJavaCompareTo() {
  69. return mType.genJavaCompareTo(getName());
  70. }
  71. public String genJavaEquals() {
  72. return mType.genJavaEquals(getName(), "peer."+getName());
  73. }
  74. public String genJavaHashCode() {
  75. return mType.genJavaHashCode(getName());
  76. }
  77. public String genJavaConstructorSet(String fname) {
  78. return mType.genJavaConstructorSet(mName, fname);
  79. }
  80. }