All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.objectos.code.ConstructorInfo Maven / Gradle / Ivy

/*
 * Copyright 2014 Objectos, Fábrica de Software LTDA.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package br.com.objectos.code;

import java.util.List;
import java.util.stream.Stream;

import br.com.objectos.testable.Equality;
import br.com.objectos.testable.Testable;
import br.com.objectos.testable.Tester;

/**
 * @author [email protected] (Marcio Endo)
 */
public abstract class ConstructorInfo implements Testable {

  public abstract AccessInfo accessInfo();
  public abstract List parameterInfoList();

  ConstructorInfo() {
  }

  public boolean hasAccessInfo(AccessInfo accessInfo) {
    return accessInfo().equals(accessInfo);
  }

  public Boolean hasParameterInfoListSize(int size) {
    return parameterInfoList().size() == size;
  }

  @Override
  public Equality isEqualTo(Object that) {
    return Tester.of(ConstructorInfo.class)
        .add("accessInfo", o -> o.accessInfo())
        .add("parameterInfoList", o -> o.parameterInfoList())
        .test(this, that);
  }

  public ConstructorInfoConstructorWriter constructorWriter() {
    return ConstructorInfoConstructorWriter.get(this);
  }

  public Stream parameterInfoStream() {
    return parameterInfoList().stream();
  }

  public ConstructorInfoCodeWriter statementWriter() {
    return ConstructorInfoCodeWriter.statementWriter(this);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy