
br.com.objectos.way.code.MethodInfoCodeWriter Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2015 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.way.code;
import java.util.List;
/**
* @author [email protected] (Marcio Endo)
*/
public class MethodInfoCodeWriter
extends
AbstractCodeWriter {
private final MethodInfo methodInfo;
private MethodInfoCodeWriter(CodeWriterMode mode, MethodInfo methodInfo) {
super(mode);
this.methodInfo = methodInfo;
}
public static MethodInfoCodeWriter codeWriter(MethodInfo methodInfo) {
return new MethodInfoCodeWriter(CodeWriterMode.CODE, methodInfo);
}
public static MethodInfoCodeWriter statementWriter(MethodInfo methodInfo) {
return new MethodInfoCodeWriter(CodeWriterMode.STATEMENT, methodInfo);
}
@Override
public ThisAdd add(String statement) {
return new ThisAdd(statement);
}
public MethodInfoCodeWriter setFieldName() {
set(methodInfo.fieldName());
return this;
}
public MethodInfoCodeWriter setMethodName() {
set(methodInfo.name());
return this;
}
@Override
List parameterInfoList() {
return methodInfo.parameterInfoList();
}
@Override
MethodInfoCodeWriter self() {
return this;
}
public class ThisAdd extends Add {
public ThisAdd(String statement) {
super(statement);
}
@Override
public ThisAdd add(String statement) {
return (ThisAdd) super.add(statement);
}
public MethodInfoCodeWriter setFieldName() {
appendStatement();
return MethodInfoCodeWriter.this.setFieldName();
}
public MethodInfoCodeWriter setMethodName() {
appendStatement();
return MethodInfoCodeWriter.this.setMethodName();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy