Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 
 package com.oneeyedmen.tdb;
 
public class Faker<T> {
    private static final Imposteriser IMPOSTERISER = .;
    @SuppressWarnings("unchecked")
    private final Class<T> type;
    public Faker(Class<T> type) {
        //noinspection unchecked
        this. = type != null ? type :
                (Class<T>) ((ParameterizedTypegetClass().getGenericSuperclass()).getActualTypeArguments()[0];
    }
    public static <T> T fakeA(Class<T> type) {
        return new Faker<T>(type).get();
    }
    protected Faker() {
        this(null);
    }
    @SuppressWarnings("unchecked")
    public T get() {
        return .imposterise(
                new MyProxiedObjectIdentity(
                        new MethodAccess(this,
                                new FieldAccess(thisnew FakeAccess()))),
                );
    }
    private class MyProxiedObjectIdentity extends ProxiedObjectIdentity{
        public MyProxiedObjectIdentity(Invokable next) {
            super(next);
        }
        @Override
        public String toString() {
            return "A fake " + .getSimpleName();
        }
    }
New to GrepCode? Check out our FAQ X