/** * Create a new basic entity builder. * @param type The entity type. * @return The entity builder. */ public static EntityBuilder newBuilder(EntityType type) { return new BasicEntityBuilder(type); }
@Override public <T> EntityBuilder setAttribute(TypedName<T> name, T val) { Preconditions.checkNotNull(name, "attribute"); Preconditions.checkNotNull(val, "value"); Preconditions.checkArgument(name.getRawType().isInstance(val), "value %s not of type %s", val, name.getType()); if (name == CommonAttributes.ENTITY_ID) { return setId(((Long) val).longValue()); } else { attributes.put(name.getName(), Attribute.create(name, val)); return this; } }
@Override public <T> EntityBuilder setAttribute(TypedName<T> name, T val) { Preconditions.checkNotNull(name, "attribute"); Preconditions.checkNotNull(val, "value"); Preconditions.checkArgument(name.getRawType().isInstance(val), "value %s not of type %s", val, name.getType()); if (name == CommonAttributes.ENTITY_ID) { return setId(((Long) val).longValue()); } else { attributes.put(name.getName(), Attribute.create(name, val)); return this; } }
/** * Create a new basic entity builder. * @param type The entity type. * @return The entity builder. */ public static EntityBuilder newBuilder(EntityType type) { return new BasicEntityBuilder(type); }