Exemplo n.º 1
0
  public AccessorKey(String className, String fieldName, AccessorType type) {
    super();
    this.className = className;
    this.fieldName = fieldName;

    final int PRIME = 31;
    int result = 1;
    result = PRIME * result + className.hashCode();
    result = PRIME * result + ((fieldName == null) ? 0 : fieldName.hashCode());
    result = PRIME * result + type.hashCode();
    this.hashCode = result;
  }
Exemplo n.º 2
0
 protected static ClassWriter createClassWriter(String internalName, AccessorType accessorType) {
   ClassWriter classWriter =
       new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
   classWriter.visit(
       V1_6,
       ACC_PUBLIC + ACC_SUPER,
       internalName,
       null,
       "java/lang/Object",
       new String[] {getInternalName(accessorType.getAccessorType().getName())});
   classWriter.visitSource(getExternalName(internalName), null);
   return classWriter;
 }
Exemplo n.º 3
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    AccessorKey other = (AccessorKey) obj;

    if (className == null) {
      if (other.className != null) return false;
    } else if (!className.equals(other.className)) return false;

    if (fieldName == null) {
      if (other.fieldName != null) return false;
    } else if (!fieldName.equals(other.fieldName)) return false;

    if (type == null) {
      if (other.type != null) return false;
    } else if (!type.equals(other.type)) return false;
    return true;
  }
Exemplo n.º 4
0
  protected static String getAccessorNameInternal(Class<?> clazz, AccessorType accessorType) {
    String typeName = toSafeName(clazz);

    return getExternalName(typeName + "$Accessor$" + accessorType.name().toLowerCase());
  }