protected MutableClassDeclaration generateImpl(final MutableClassDeclaration impl, @Extension final TransformationContext context) { final Function1<AnnotationReference, Boolean> _function = (AnnotationReference it) -> { AnnotationTypeDeclaration _annotationTypeDeclaration = it.getAnnotationTypeDeclaration(); Type _findTypeGlobally = context.findTypeGlobally(JsonRpcData.class); return Boolean.valueOf(Objects.equal(_annotationTypeDeclaration, _findTypeGlobally)); }; impl.removeAnnotation(IterableExtensions.findFirst(impl.getAnnotations(), _function)); JsonRpcDataTransformationContext _jsonRpcDataTransformationContext = new JsonRpcDataTransformationContext(context); this.generateImplMembers(impl, _jsonRpcDataTransformationContext); this.generateToString(impl, context); Type _type = impl.getExtendedClass().getType(); Type _type_1 = context.newTypeReference(Object.class).getType(); final boolean shouldIncludeSuper = (!Objects.equal(_type, _type_1)); final EqualsHashCodeProcessor.Util equalsHashCodeUtil = new EqualsHashCodeProcessor.Util(context); final Function1<MutableFieldDeclaration, Boolean> _function_1 = (MutableFieldDeclaration it) -> { boolean _isStatic = it.isStatic(); return Boolean.valueOf((!_isStatic)); }; final Iterable<? extends MutableFieldDeclaration> fields = IterableExtensions.filter(impl.getDeclaredFields(), _function_1); equalsHashCodeUtil.addEquals(impl, fields, shouldIncludeSuper); equalsHashCodeUtil.addHashCode(impl, fields, shouldIncludeSuper); return impl; }
public StringConcatenationClient contributeToEquals(final FieldDeclaration it) { StringConcatenationClient _switchResult = null; String _name = this.orObject(it.getType()).getName(); boolean _matched = false; String _name_1 = Double.TYPE.getName();
public StringConcatenationClient contributeToHashCode(final FieldDeclaration it) { StringConcatenationClient _switchResult = null; String _name = this.orObject(it.getType()).getName(); boolean _matched = false; String _name_1 = Double.TYPE.getName();
final AccessorsProcessor.Util getterUtil = new AccessorsProcessor.Util(context); @Extension final EqualsHashCodeProcessor.Util ehUtil = new EqualsHashCodeProcessor.Util(context); @Extension final ToStringProcessor.Util toStringUtil = new ToStringProcessor.Util(context); requiredArgsUtil.addFinalFieldsConstructor(it); boolean _hasHashCode = ehUtil.hasHashCode(it); boolean _not = (!_hasHashCode); if (_not) { ehUtil.addHashCode(it, util.getDataFields(it), ehUtil.hasSuperHashCode(it)); boolean _hasEquals = ehUtil.hasEquals(it); boolean _not_1 = (!_hasEquals); if (_not_1) { ehUtil.addEquals(it, util.getDataFields(it), ehUtil.hasSuperEquals(it));
public StringConcatenationClient deepHashCode(final FieldDeclaration it) { StringConcatenationClient _xblockexpression = null; final TypeReference type = this.orObject(it.getType()); StringConcatenationClient _xifexpression = null; boolean _isArray = type.isArray();
final AccessorsProcessor.Util getterUtil = new AccessorsProcessor.Util(context); @Extension final EqualsHashCodeProcessor.Util ehUtil = new EqualsHashCodeProcessor.Util(context); @Extension final ToStringProcessor.Util toStringUtil = new ToStringProcessor.Util(context); requiredArgsUtil.addFinalFieldsConstructor(it); boolean _hasHashCode = ehUtil.hasHashCode(it); boolean _not = (!_hasHashCode); if (_not) { ehUtil.addHashCode(it, util.getDataFields(it), ehUtil.hasSuperHashCode(it)); boolean _hasEquals = ehUtil.hasEquals(it); boolean _not_1 = (!_hasEquals); if (_not_1) { ehUtil.addEquals(it, util.getDataFields(it), ehUtil.hasSuperEquals(it));
@Override public void doTransform(final MutableClassDeclaration it, @Extension final TransformationContext context) { AnnotationReference _findAnnotation = it.findAnnotation(context.findTypeGlobally(Data.class)); boolean _tripleNotEquals = (_findAnnotation != null); if (_tripleNotEquals) { return; } @Extension final EqualsHashCodeProcessor.Util util = new EqualsHashCodeProcessor.Util(context); boolean _hasEquals = util.hasEquals(it); if (_hasEquals) { final AnnotationReference annotation = it.findAnnotation(context.findTypeGlobally(EqualsHashCode.class)); context.addWarning(annotation, "equals is already defined, this annotation has no effect"); } else { boolean _hasHashCode = util.hasHashCode(it); if (_hasHashCode) { context.addWarning(it, "hashCode is already defined, this annotation has no effect"); } else { final Function1<MutableFieldDeclaration, Boolean> _function = (MutableFieldDeclaration it_1) -> { return Boolean.valueOf((((!it_1.isStatic()) && (!it_1.isTransient())) && context.isThePrimaryGeneratedJavaElement(it_1))); }; final Iterable<? extends MutableFieldDeclaration> fields = IterableExtensions.filter(it.getDeclaredFields(), _function); util.addEquals(it, fields, util.hasSuperEquals(it)); util.addHashCode(it, fields, util.hasSuperHashCode(it)); } } } }
public boolean hasSuperHashCode(final ClassDeclaration cls) { boolean _xblockexpression = false; { Type _type = cls.getExtendedClass().getType(); final ClassDeclaration superClass = ((ClassDeclaration) _type); boolean _xifexpression = false; boolean _equals = this.context.newTypeReference(superClass).equals(this.context.getObject()); if (_equals) { _xifexpression = false; } else { boolean _xifexpression_1 = false; boolean _hasHashCode = this.hasHashCode(superClass); if (_hasHashCode) { _xifexpression_1 = true; } else { _xifexpression_1 = this.hasSuperHashCode(superClass); } _xifexpression = _xifexpression_1; } _xblockexpression = _xifexpression; } return _xblockexpression; }
protected MutableClassDeclaration generateImpl(final MutableClassDeclaration impl, @Extension final TransformationContext context) { final Function1<AnnotationReference, Boolean> _function = (AnnotationReference it) -> { AnnotationTypeDeclaration _annotationTypeDeclaration = it.getAnnotationTypeDeclaration(); Type _findTypeGlobally = context.findTypeGlobally(JsonRpcData.class); return Boolean.valueOf(Objects.equal(_annotationTypeDeclaration, _findTypeGlobally)); }; impl.removeAnnotation(IterableExtensions.findFirst(impl.getAnnotations(), _function)); JsonRpcDataTransformationContext _jsonRpcDataTransformationContext = new JsonRpcDataTransformationContext(context); this.generateImplMembers(impl, _jsonRpcDataTransformationContext); this.generateToString(impl, context); Type _type = impl.getExtendedClass().getType(); Type _type_1 = context.newTypeReference(Object.class).getType(); final boolean shouldIncludeSuper = (!Objects.equal(_type, _type_1)); final EqualsHashCodeProcessor.Util equalsHashCodeUtil = new EqualsHashCodeProcessor.Util(context); final Function1<MutableFieldDeclaration, Boolean> _function_1 = (MutableFieldDeclaration it) -> { boolean _isStatic = it.isStatic(); return Boolean.valueOf((!_isStatic)); }; final Iterable<? extends MutableFieldDeclaration> fields = IterableExtensions.filter(impl.getDeclaredFields(), _function_1); equalsHashCodeUtil.addEquals(impl, fields, shouldIncludeSuper); equalsHashCodeUtil.addHashCode(impl, fields, shouldIncludeSuper); return impl; }
public boolean hasSuperEquals(final ClassDeclaration cls) { boolean _xblockexpression = false; { Type _type = cls.getExtendedClass().getType(); final ClassDeclaration superClass = ((ClassDeclaration) _type); boolean _xifexpression = false; boolean _equals = this.context.newTypeReference(superClass).equals(this.context.getObject()); if (_equals) { _xifexpression = false; } else { boolean _xifexpression_1 = false; boolean _hasEquals = this.hasEquals(superClass); if (_hasEquals) { _xifexpression_1 = true; } else { _xifexpression_1 = this.hasSuperEquals(superClass); } _xifexpression = _xifexpression_1; } _xblockexpression = _xifexpression; } return _xblockexpression; }