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

net.gdface.sdk.decorator.NotFaceDetectedException Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
package net.gdface.sdk.decorator;
import net.gdface.thrift.ThriftDecorator;
import net.gdface.thrift.exception.BaseServiceException;

import java.io.PrintStream;
import java.io.PrintWriter;
import com.facebook.swift.codec.ThriftStruct;
import com.facebook.swift.codec.ThriftField;
import com.facebook.swift.codec.ThriftField.Requiredness;
import static com.google.common.base.Preconditions.checkNotNull;

/**
 * decorator pattern 装饰者模式代理{@link net.gdface.sdk.NotFaceDetectedException}
* 代理对象必须有默认构造方法,String参数构造方法可选,必须是普通类型,不可以有@ThriftStruct注释
* 转发所有{@link net.gdface.sdk.NotFaceDetectedException}get/set方法到{@link #delegate()}指定的实例,
* 计算机生成代码(generated by automated tools ThriftServiceDecoratorGenerator @author guyadong)
* @author guyadong * */ @ThriftStruct public final class NotFaceDetectedException extends BaseServiceException implements ThriftDecorator { private static final long serialVersionUID = 1L; private final net.gdface.sdk.NotFaceDetectedException delegate; public NotFaceDetectedException(){ this(new net.gdface.sdk.NotFaceDetectedException()); } public NotFaceDetectedException(String message){ this(new net.gdface.sdk.NotFaceDetectedException(message)); } public NotFaceDetectedException(net.gdface.sdk.NotFaceDetectedException delegate) { super(checkNotNull(delegate,"delegate is null").getMessage(),delegate.getCause()); // 检查被装饰类是否有@ThriftStruct注释 if(delegate.getClass().isAnnotationPresent(ThriftStruct.class)){ throw new IllegalArgumentException( String.format("NOT ALLOW %s have @ThriftStruct annotation",delegate.getClass().getName())); } this.delegate = delegate; } /** * 返回被装饰的{@link net.gdface.sdk.NotFaceDetectedException}实例 * @return */ @Override public net.gdface.sdk.NotFaceDetectedException delegate() { return delegate; } @Override public void printStackTrace() { delegate().printStackTrace(); } @Override public void printStackTrace(PrintStream s) { delegate().printStackTrace(s); } @Override public void printStackTrace(PrintWriter s) { delegate().printStackTrace(s); } @Override public StackTraceElement[] getStackTrace() { return delegate().getStackTrace(); } @Override public Throwable initCause(Throwable cause) { return delegate().initCause(cause); } @Override public int hashCode() { return delegate().hashCode(); } @Override public boolean equals(Object obj) { return delegate().equals(obj); } @Override public String toString() { return delegate().toString(); } @ThriftField(value = 5,name = "codeNum",requiredness=Requiredness.REQUIRED) public int getCodeNum(){ return delegate().getCodeNum(); } @ThriftField public void setCodeNum(int value){ delegate().setCodeNum(value); } @ThriftField(value = 6,name = "faceNum",requiredness=Requiredness.REQUIRED) public int getFaceNum(){ return delegate().getFaceNum(); } @ThriftField public void setFaceNum(int value){ delegate().setFaceNum(value); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy