Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

DeclareParentsMixin.java 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* *******************************************************************
  2. * Copyright (c) 2009 Contributors
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v 2.0
  6. * which accompanies this distribution and is available at
  7. * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  8. *
  9. * Contributors:
  10. * initial implementation Andy Clement
  11. * ******************************************************************/
  12. package org.aspectj.weaver.patterns;
  13. import java.io.IOException;
  14. import java.util.List;
  15. import org.aspectj.weaver.CompressingDataOutputStream;
  16. import org.aspectj.weaver.ISourceContext;
  17. import org.aspectj.weaver.VersionedDataInputStream;
  18. /**
  19. * Constructed based on an @DeclareMixin being found in an aspect.
  20. *
  21. * @author Andy Clement
  22. */
  23. public class DeclareParentsMixin extends DeclareParents {
  24. private int bitflags = 0x0000; // for future expansion
  25. public DeclareParentsMixin(TypePattern child, List parents) {
  26. super(child, parents, true);
  27. }
  28. public DeclareParentsMixin(TypePattern child, TypePatternList parents) {
  29. super(child, parents, true);
  30. }
  31. public boolean equals(Object other) {
  32. if (!(other instanceof DeclareParentsMixin)) {
  33. return false;
  34. }
  35. DeclareParentsMixin o = (DeclareParentsMixin) other;
  36. return o.child.equals(child) && o.parents.equals(parents) && o.bitflags == bitflags;
  37. }
  38. public int hashCode() {
  39. int result = 23;
  40. result = 37 * result + child.hashCode();
  41. result = 37 * result + parents.hashCode();
  42. result = 37 * result + bitflags;
  43. return result;
  44. }
  45. public void write(CompressingDataOutputStream s) throws IOException {
  46. s.writeByte(Declare.PARENTSMIXIN);
  47. child.write(s);
  48. parents.write(s);
  49. writeLocation(s);
  50. s.writeInt(bitflags);
  51. }
  52. public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException {
  53. DeclareParentsMixin ret = new DeclareParentsMixin(TypePattern.read(s, context), TypePatternList.read(s, context));
  54. ret.readLocation(context, s);
  55. ret.bitflags = s.readInt();
  56. return ret;
  57. }
  58. public String toString() {
  59. StringBuilder buf = new StringBuilder();
  60. buf.append("declare parents mixin: ");
  61. buf.append(child);
  62. buf.append(" implements ");
  63. buf.append(parents);
  64. buf.append(";");
  65. buf.append("bits=0x").append(Integer.toHexString(bitflags));
  66. return buf.toString();
  67. }
  68. public boolean isMixin() {
  69. return true;
  70. }
  71. }