_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q155200 | XmlFile.parseOnce | train | public <T> Optional<T> parseOnce( XmlParser<? extends T> parser )
throws IOException, SAXException, ParserConfigurationException
{
return resolver.parsed( path ) ? Optional.empty() : Optional.of( parse( parser ) );
} | java | {
"resource": ""
} |
q155201 | Description.findStart | train | private static int findStart( char[] buffer, int start, int end )
{
int pos, cp;
for ( pos = start; pos < end && isWhitespace( cp = codePointAt( buffer, pos ) ); pos += charCount( cp ) )
{
if ( cp == '\n' )
{
start = pos + 1;
}
}
... | java | {
"resource": ""
} |
q155202 | LiteralNode.textLiteral | train | private static void textLiteral( Consumer<? super LiteralNode> add, String literal )
{
add.accept( literal( literal, false ) );
} | java | {
"resource": ""
} |
q155203 | DataFlowVariable.getVal | train | public Object getVal(long waitTime, TimeUnit timeUnit)
throws InterruptedException
{
if(latch.await(waitTime, timeUnit)){
return val;
}
else
{
return null;
}
} | java | {
"resource": ""
} |
q155204 | NettyTCPMessageSender.closeAfterFlushingPendingWrites | train | public void closeAfterFlushingPendingWrites(Channel channel, Event event)
{
if (channel.isConnected())
{
channel.write(event).addListener(ChannelFutureListener.CLOSE);
}
else
{
System.err.println("Unable to write the Event :" + event
+ " to socket as channel is ot connected");
}
} | java | {
"resource": ""
} |
q155205 | JavaObjectToAMF3Encoder.convertBAOSToChannelBuffer | train | public ChannelBuffer convertBAOSToChannelBuffer(ByteArrayOutputStream baos)
{
if (null == baos)
return null;
return wrappedBuffer(baos.toByteArray());
} | java | {
"resource": ""
} |
q155206 | AMFDeSerializer.fromAmf | train | @SuppressWarnings("unchecked")
public <T> T fromAmf(final ByteArrayInputStream amf)
throws ClassNotFoundException, IOException {
Amf3Input amf3Input = new Amf3Input(context);
amf3Input.setInputStream(amf);
// Read object does the actual work of conversion.
return (T) amf3Input.readObject();
} | java | {
"resource": ""
} |
q155207 | NettyUtils.readString | train | public static String readString(ChannelBuffer buffer, Charset charset)
{
String readString = null;
if (null != buffer && buffer.readableBytes() > 2)
{
int length = buffer.readUnsignedShort();
readString = readString(buffer, length, charset);
}
return readString;
} | java | {
"resource": ""
} |
q155208 | NettyUtils.readString | train | public static String readString(ChannelBuffer buffer, int length,
Charset charset)
{
String str = null;
if (null == charset)
{
charset = CharsetUtil.UTF_8;
}
try
{
ChannelBuffer stringBuffer = buffer.readSlice(length);
str = stringBuffer.toString(charset);
}
catch (Exception e)
{
throw... | java | {
"resource": ""
} |
q155209 | NettyUtils.writeString | train | public static ChannelBuffer writeString(String msg, Charset charset)
{
ChannelBuffer buffer = null;
try
{
ChannelBuffer stringBuffer = null;
if (null == charset)
{
charset = CharsetUtil.UTF_8;
}
stringBuffer = copiedBuffer(ByteOrder.BIG_ENDIAN, msg, charset);
int length = stringBuffer.read... | java | {
"resource": ""
} |
q155210 | UDPChannelPipelineFactory.init | train | public void init()
{
pipeline = pipeline();
pipeline.addLast("messageBufferEventDecoder", messageBufferEventDecoder);
pipeline.addLast("upstream", upstream);
// Downstream handlers - Filter for data which flows from server to
// client. Note that the last handler added is actually the first
... | java | {
"resource": ""
} |
q155211 | Fibers.pooledFiber | train | public static Fiber pooledFiber(Lane<String,ExecutorService> lane)
{
if(null == lanePoolFactoryMap.get(lane))
{
lanePoolFactoryMap.putIfAbsent(lane, new PoolFiberFactory(lane.getUnderlyingLane()));
}
Fiber fiber = lanePoolFactoryMap.get(lane).create();
fiber.start();
return fiber;
} | java | {
"resource": ""
} |
q155212 | AMFSerializer.toAmf | train | public <T> ByteArrayOutputStream toAmf(final T source) throws IOException
{
// Create and instance of the byte array output stream to write the AMF3
// object to.
final ByteArrayOutputStream bout = new ByteArrayOutputStream();
// Create the AMF3Output object and set its output stream.
final Amf3Output ... | java | {
"resource": ""
} |
q155213 | AppContext.getBean | train | public static Object getBean(String beanName)
{
if (null == beanName)
{
return null;
}
return applicationContext.getBean(beanName);
} | java | {
"resource": ""
} |
q155214 | NettyUtils.clearPipeline | train | public static void clearPipeline(ChannelPipeline pipeline)
{
if(null == pipeline){
return;
}
try
{
int counter = 0;
while (pipeline.getFirst() != null)
{
pipeline.removeFirst();
counter++;
}
LOG.trace("Removed {} handlers from pipeline",counter);
}
catch (NoSuchElementExceptio... | java | {
"resource": ""
} |
q155215 | NettyUtils.readString | train | public static String readString(ChannelBuffer buffer, int length)
{
return readString(buffer, length, CharsetUtil.UTF_8);
// char[] chars = new char[length];
// for (int i = 0; i < length; i++)
// {
// chars[i] = buffer.readChar();
// }
// return new String(chars);
} | java | {
"resource": ""
} |
q155216 | NettyUtils.readSocketAddress | train | public static InetSocketAddress readSocketAddress(ChannelBuffer buffer)
{
String remoteHost = NettyUtils.readString(buffer);
int remotePort = 0;
if (buffer.readableBytes() >= 4)
{
remotePort = buffer.readInt();
}
else
{
return null;
}
InetSocketAddress remoteAddress = null;
if (null != remote... | java | {
"resource": ""
} |
q155217 | GameRoomSession.createAndAddEventHandlers | train | protected void createAndAddEventHandlers(PlayerSession playerSession)
{
// Create a network event listener for the player session.
EventHandler networkEventHandler = new NetworkEventListener(playerSession);
// Add the handler to the game room's EventDispatcher so that it will
// pass game room network events t... | java | {
"resource": ""
} |
q155218 | JetlangEventDispatcher.addANYHandler | train | protected void addANYHandler(final EventHandler eventHandler)
{
final int eventType = eventHandler.getEventType();
if (eventType != Events.ANY)
{
LOG.error("The incoming handler {} is not of type ANY",
eventHandler);
throw new IllegalArgumentException(
"The incoming handler is not of type ANY");
... | java | {
"resource": ""
} |
q155219 | LoginHelper.getLoginBuffer | train | public MessageBuffer<ChannelBuffer> getLoginBuffer(
InetSocketAddress localUDPAddress) throws Exception
{
ChannelBuffer loginBuffer;
ChannelBuffer credentials = NettyUtils.writeStrings(username, password,
connectionKey);
if (null != localUDPAddress)
{
ChannelBuffer udpAddressBuffer = NettyUtils
... | java | {
"resource": ""
} |
q155220 | LoginHelper.getReconnectBuffer | train | public MessageBuffer<ChannelBuffer> getReconnectBuffer(String reconnectKey,
InetSocketAddress udpAddress)
{
ChannelBuffer reconnectBuffer = null;
ChannelBuffer buffer = NettyUtils.writeString(reconnectKey);
if (null != udpAddress)
{
reconnectBuffer = ChannelBuffers.wrappedBuffer(buffer,
NettyUtils.w... | java | {
"resource": ""
} |
q155221 | SessionFactory.connectSession | train | public void connectSession(final Session session,
EventHandler... eventHandlers) throws InterruptedException,
Exception
{
InetSocketAddress udpAddress = null;
if (null != udpClient)
{
udpAddress = doUdpConnection(session);
}
if (null != eventHandlers)
{
for (EventHandler eventHandler : eventHa... | java | {
"resource": ""
} |
q155222 | SessionFactory.reconnectSession | train | public void reconnectSession(final Session session, String reconnectKey)
throws InterruptedException, Exception
{
session.getTcpMessageSender().close();
if (null != session.getUdpMessageSender())
session.getUdpMessageSender().close();
InetSocketAddress udpAddress = null;
if (null != udpClient)
{
ud... | java | {
"resource": ""
} |
q155223 | Assert.parametersNotNull | train | public static void parametersNotNull(final String names, final Object... objects) {
String msgPrefix = "At least one of the parameters";
if (objects != null) {
if (objects.length == 1) {
msgPrefix = "Parameter";
}
for (final Object object : objects) ... | java | {
"resource": ""
} |
q155224 | Assert.parameterNotNull | train | public static void parameterNotNull(final String name, final Object reference) {
if (reference == null) {
raiseError(format("Parameter '%s' is not expected to be null.", name));
}
} | java | {
"resource": ""
} |
q155225 | Assert.parameterNotEmpty | train | public static void parameterNotEmpty(final String name, final Iterable obj) {
if (!obj.iterator().hasNext()) {
raiseError(format("Parameter '%s' from type '%s' is expected to NOT be empty", name, obj.getClass().getName()));
}
} | java | {
"resource": ""
} |
q155226 | Assert.parameterNotEmpty | train | public static void parameterNotEmpty(final String name, final String value) {
if (value != null && value.length() == 0) {
raiseError(format("Parameter '%s' is expected to NOT be empty.", name));
}
} | java | {
"resource": ""
} |
q155227 | IterHelper.loopMap | train | @SuppressWarnings("unchecked")
public void loopMap(final Object x, final MapIterCallback<K, V> callback) {
if (x == null) {
return;
}
if (x instanceof Collection) {
throw new IllegalArgumentException("call loop instead");
}
if (x instanceof HashMap<?... | java | {
"resource": ""
} |
q155228 | UpdateOptions.copy | train | public UpdateOptions copy() {
return new UpdateOptions()
.bypassDocumentValidation(getBypassDocumentValidation())
.collation(getCollation())
.multi(isMulti())
.upsert(isUpsert())
.writeConcern(getWriteConcern());
} | java | {
"resource": ""
} |
q155229 | GeoWithinOperationValidator.isValueAValidGeoQuery | train | private static boolean isValueAValidGeoQuery(final Object value) {
if (value instanceof DBObject) {
String key = ((DBObject) value).keySet().iterator().next();
return key.equals("$box") || key.equals("$center") || key.equals("$centerSphere") || key.equals("$polygon");
}
r... | java | {
"resource": ""
} |
q155230 | MappingValidator.validate | train | @Deprecated
public void validate(final Mapper mapper, final MappedClass mappedClass) {
validate(mapper, singletonList(mappedClass));
} | java | {
"resource": ""
} |
q155231 | MappingValidator.validate | train | public void validate(final Mapper mapper, final List<MappedClass> classes) {
final Set<ConstraintViolation> ve = new TreeSet<ConstraintViolation>(new Comparator<ConstraintViolation>() {
@Override
public int compare(final ConstraintViolation o1, final ConstraintViolation o2) {
... | java | {
"resource": ""
} |
q155232 | Morphia.createDatastore | train | @SuppressWarnings("deprecation")
public Datastore createDatastore(final MongoClient mongoClient, final String dbName) {
return new DatastoreImpl(this, mongoClient, dbName);
} | java | {
"resource": ""
} |
q155233 | Morphia.mapPackage | train | public synchronized Morphia mapPackage(final String packageName, final boolean ignoreInvalidClasses) {
try {
for (final Class clazz : ReflectionUtils.getClasses(getClass().getClassLoader(), packageName,
mapper.getOptions().isMapSubPackages())) {
try {
... | java | {
"resource": ""
} |
q155234 | Morphia.toDBObject | train | public DBObject toDBObject(final Object entity) {
try {
return mapper.toDBObject(entity);
} catch (Exception e) {
throw new MappingException("Could not map entity to DBObject", e);
}
} | java | {
"resource": ""
} |
q155235 | MapReduceOptions.map | train | public MapReduceOptions<T> map(final String map) {
Assert.parametersNotNull("map", map);
Assert.parameterNotEmpty("map", map);
this.map = map;
return this;
} | java | {
"resource": ""
} |
q155236 | MapReduceOptions.query | train | public MapReduceOptions<T> query(final Query query) {
Assert.parametersNotNull("query", query);
this.query = query;
return this;
} | java | {
"resource": ""
} |
q155237 | MapReduceOptions.reduce | train | public MapReduceOptions<T> reduce(final String reduce) {
Assert.parametersNotNull("reduce", reduce);
Assert.parameterNotEmpty("reduce", reduce);
this.reduce = reduce;
return this;
} | java | {
"resource": ""
} |
q155238 | ReflectionUtils.isIntegerType | train | public static boolean isIntegerType(final Class type) {
return Arrays.<Class>asList(Integer.class, int.class, Long.class, long.class, Short.class, short.class, Byte.class,
byte.class).contains(type);
} | java | {
"resource": ""
} |
q155239 | ReflectionUtils.isPropertyType | train | public static boolean isPropertyType(final Type type) {
if (type instanceof GenericArrayType) {
return isPropertyType(((GenericArrayType) type).getGenericComponentType());
}
if (type instanceof ParameterizedType) {
return isPropertyType(((ParameterizedType) type).getRawTy... | java | {
"resource": ""
} |
q155240 | ReflectionUtils.getParameterizedType | train | public static Type getParameterizedType(final Field field, final int index) {
if (field != null) {
if (field.getGenericType() instanceof ParameterizedType) {
final ParameterizedType type = (ParameterizedType) field.getGenericType();
if ((type.getActualTypeArguments() ... | java | {
"resource": ""
} |
q155241 | ReflectionUtils.getParameterizedClass | train | public static Class getParameterizedClass(final Class c, final int index) {
final TypeVariable[] typeVars = c.getTypeParameters();
if (typeVars.length > 0) {
final TypeVariable typeVariable = typeVars[index];
final Type[] bounds = typeVariable.getBounds();
final Type... | java | {
"resource": ""
} |
q155242 | ReflectionUtils.isFieldParameterizedWithClass | train | public static boolean isFieldParameterizedWithClass(final Field field, final Class c) {
if (field.getGenericType() instanceof ParameterizedType) {
final ParameterizedType genericType = (ParameterizedType) field.getGenericType();
for (final Type type : genericType.getActualTypeArguments()... | java | {
"resource": ""
} |
q155243 | ReflectionUtils.isFieldParameterizedWithPropertyType | train | public static boolean isFieldParameterizedWithPropertyType(final Field field) {
if (field.getGenericType() instanceof ParameterizedType) {
final ParameterizedType genericType = (ParameterizedType) field.getGenericType();
for (final Type type : genericType.getActualTypeArguments()) {
... | java | {
"resource": ""
} |
q155244 | ReflectionUtils.isPropertyType | train | public static boolean isPropertyType(final Class type) {
return type != null && (isPrimitiveLike(type) || type == DBRef.class || type == Pattern.class
|| type == CodeWScope.class || type == ObjectId.class || type == Key.class
|| type == DBObject.cl... | java | {
"resource": ""
} |
q155245 | ReflectionUtils.isPrimitiveLike | train | public static boolean isPrimitiveLike(final Class type) {
return type != null && (type == String.class || type == char.class
|| type == Character.class || type == short.class || type == Short.class
|| type == Integer.class || type == int.class || t... | java | {
"resource": ""
} |
q155246 | ReflectionUtils.getAnnotation | train | public static <T> T getAnnotation(final Class c, final Class<T> annotation) {
final List<T> found = getAnnotations(c, annotation);
if (found != null && !found.isEmpty()) {
return found.get(0);
} else {
return null;
}
} | java | {
"resource": ""
} |
q155247 | ReflectionUtils.getFromJarFile | train | public static Set<Class<?>> getFromJarFile(final ClassLoader loader, final String jar, final String packageName, final boolean
mapSubPackages)
throws IOException, ClassNotFoundException {
... | java | {
"resource": ""
} |
q155248 | ReflectionUtils.getFromDirectory | train | public static Set<Class<?>> getFromDirectory(final ClassLoader loader, final File directory, final String packageName,
final boolean mapSubPackages) throws ClassNotFoundException {
final Set<Class<?>> classes = new HashSet<Class<?>>();
if (directory.exist... | java | {
"resource": ""
} |
q155249 | ReflectionUtils.iterToList | train | public static <T> List<T> iterToList(final Iterable<T> it) {
if (it instanceof List) {
return (List<T>) it;
}
if (it == null) {
return null;
}
final List<T> ar = new ArrayList<T>();
for (final T o : it) {
ar.add(o);
}
... | java | {
"resource": ""
} |
q155250 | ReflectionUtils.convertToArray | train | public static Object convertToArray(final Class type, final List<?> values) {
final Object exampleArray = Array.newInstance(type, values.size());
try {
return values.toArray((Object[]) exampleArray);
} catch (ClassCastException e) {
for (int i = 0; i < values.size(); i++)... | java | {
"resource": ""
} |
q155251 | ReflectionUtils.getTypeArgument | train | public static <T> Class<?> getTypeArgument(final Class<? extends T> clazz, final TypeVariable<? extends GenericDeclaration> tv) {
final Map<Type, Type> resolvedTypes = new HashMap<Type, Type>();
Type type = clazz;
// start walking up the inheritance hierarchy until we hit the end
while (... | java | {
"resource": ""
} |
q155252 | DefaultMapEntry.setValue | train | public Object setValue(final Object value) {
final Object answer = this.value;
this.value = value;
return answer;
} | java | {
"resource": ""
} |
q155253 | MorphiaReference.wrap | train | @SuppressWarnings("unchecked")
public static <V> MorphiaReference<V> wrap(final V value) {
if (value instanceof List) {
return (MorphiaReference<V>) new ListReference<V>((List<V>) value);
} else if (value instanceof Set) {
return (MorphiaReference<V>) new SetReference<V>((Set... | java | {
"resource": ""
} |
q155254 | PushOptions.sort | train | public PushOptions sort(final String field, final int direction) {
if (sort != null) {
throw new IllegalStateException("sortDocument can not be set if sort already is");
}
if (sortDocument == null) {
sortDocument = new BasicDBObject();
}
sortDocument.put(f... | java | {
"resource": ""
} |
q155255 | AggregationPipelineImpl.toDBObject | train | private DBObject toDBObject(final Projection projection) {
String target;
if (firstStage) {
MappedField field = mapper.getMappedClass(source).getMappedField(projection.getTarget());
target = field != null ? field.getNameToStore() : projection.getTarget();
} else {
... | java | {
"resource": ""
} |
q155256 | MorphiaUtils.join | train | public static String join(final List<String> strings, final char delimiter) {
StringBuilder builder = new StringBuilder();
for (String element : strings) {
if (builder.length() != 0) {
builder.append(delimiter);
}
builder.append(element);
}
... | java | {
"resource": ""
} |
q155257 | TypeValidator.apply | train | public boolean apply(final Class<?> type, final Object value,
final List<ValidationFailure> validationFailures) {
if (appliesTo(type)) {
validate(type, value, validationFailures);
return true;
}
return false;
} | java | {
"resource": ""
} |
q155258 | Mapper.addMappedClass | train | public MappedClass addMappedClass(final Class c) {
MappedClass mappedClass = mappedClasses.get(c.getName());
if (mappedClass == null) {
mappedClass = new MappedClass(c, this);
return addMappedClass(mappedClass, true);
}
return mappedClass;
} | java | {
"resource": ""
} |
q155259 | Mapper.getSubTypes | train | public List<MappedClass> getSubTypes(final MappedClass mc) {
List<MappedClass> subtypes = new ArrayList<MappedClass>();
for (MappedClass mappedClass : getMappedClasses()) {
if (mappedClass.isSubType(mc)) {
subtypes.add(mappedClass);
}
}
return sub... | java | {
"resource": ""
} |
q155260 | Mapper.getClassFromCollection | train | @Deprecated
public Class<?> getClassFromCollection(final String collection) {
final Set<MappedClass> mcs = mappedClassesByCollection.get(collection);
if (mcs == null || mcs.isEmpty()) {
throw new MappingException(format("The collection '%s' is not mapped to a java class.", collection));
... | java | {
"resource": ""
} |
q155261 | Mapper.getCollectionName | train | @Deprecated
public String getCollectionName(final Object object) {
if (object == null) {
throw new IllegalArgumentException();
}
final MappedClass mc = getMappedClass(object);
return mc.getCollectionName();
} | java | {
"resource": ""
} |
q155262 | Mapper.getId | train | public Object getId(final Object entity) {
Object unwrapped = entity;
if (unwrapped == null) {
return null;
}
unwrapped = ProxyHelper.unwrap(unwrapped);
try {
final MappedClass mappedClass = getMappedClass(unwrapped.getClass());
if (mappedClass... | java | {
"resource": ""
} |
q155263 | Mapper.getKey | train | public <T> Key<T> getKey(final T entity) {
T unwrapped = entity;
if (unwrapped instanceof ProxiedEntityReference) {
final ProxiedEntityReference proxy = (ProxiedEntityReference) unwrapped;
return (Key<T>) proxy.__getKey();
}
unwrapped = ProxyHelper.unwrap(unwrapp... | java | {
"resource": ""
} |
q155264 | Mapper.keyToDBRef | train | public DBRef keyToDBRef(final Key key) {
if (key == null) {
return null;
}
if (key.getType() == null && key.getCollection() == null) {
throw new IllegalStateException("How can it be missing both?");
}
if (key.getCollection() == null) {
key.setC... | java | {
"resource": ""
} |
q155265 | Mapper.manualRefToKey | train | public <T> Key<T> manualRefToKey(final Class<T> type, final Object id) {
return id == null ? null : new Key<T>(type, getCollectionName(type), id);
} | java | {
"resource": ""
} |
q155266 | Mapper.refToKey | train | public <T> Key<T> refToKey(final DBRef ref) {
return ref == null ? null : new Key<T>((Class<? extends T>) getClassFromCollection(ref.getCollectionName()),
ref.getCollectionName(), ref.getId());
} | java | {
"resource": ""
} |
q155267 | Mapper.updateCollection | train | public String updateCollection(final Key key) {
if (key.getCollection() == null && key.getType() == null) {
throw new IllegalStateException("Key is invalid! " + toString());
} else if (key.getCollection() == null) {
key.setCollection(getMappedClass(key.getType()).getCollectionNam... | java | {
"resource": ""
} |
q155268 | Mapper.addMappedClass | train | private MappedClass addMappedClass(final MappedClass mc, final boolean validate) {
addConverters(mc);
if (validate && !mc.isInterface()) {
mc.validate(this);
}
mappedClasses.put(mc.getClazz().getName(), mc);
Set<MappedClass> mcs = mappedClassesByCollection.get(mc.g... | java | {
"resource": ""
} |
q155269 | EntityCacheStatistics.copy | train | public EntityCacheStatistics copy() {
final EntityCacheStatistics copy = new EntityCacheStatistics();
copy.entities = entities;
copy.hits = hits;
copy.misses = misses;
return copy;
} | java | {
"resource": ""
} |
q155270 | BucketAutoOptions.toDBObject | train | public DBObject toDBObject() {
DBObject dbObject = new BasicDBObject();
if (granularity != null) {
dbObject.put("granularity", granularity.getGranulality());
}
DBObject output = new BasicDBObject();
for (Map.Entry<String, Accumulator> entry : accumulators.entrySet())... | java | {
"resource": ""
} |
q155271 | Shape.toDBObject | train | public DBObject toDBObject() {
final BasicDBList list = new BasicDBList();
for (final Point point : points) {
list.add(point.toDBObject());
}
return new BasicDBObject(geometry, list);
} | java | {
"resource": ""
} |
q155272 | FindOptions.modifier | train | public FindOptions modifier(final String key, final Object value) {
options.getModifiers().put(key, value);
return this;
} | java | {
"resource": ""
} |
q155273 | UpdateOpsImpl.setOps | train | @SuppressWarnings("unchecked")
public void setOps(final DBObject ops) {
this.ops = (Map<String, Map<String, Object>>) ops;
} | java | {
"resource": ""
} |
q155274 | ProxyHelper.unwrap | train | @SuppressWarnings("unchecked")
public static <T> T unwrap(final T entity) {
if (isProxy(entity)) {
return (T) asProxy(entity).__unwrap();
}
return entity;
} | java | {
"resource": ""
} |
q155275 | ProxyHelper.getReferentClass | train | public static Class getReferentClass(final Object entity) {
if (isProxy(entity)) {
return asProxy(entity).__getReferenceObjClass();
} else {
return entity != null ? entity.getClass() : null;
}
} | java | {
"resource": ""
} |
q155276 | ProxyHelper.isFetched | train | public static boolean isFetched(final Object entity) {
return entity == null || !isProxy(entity) || asProxy(entity).__isFetched();
} | java | {
"resource": ""
} |
q155277 | CountOptions.maxTime | train | public CountOptions maxTime(final long maxTime, final TimeUnit timeUnit) {
notNull("timeUnit", timeUnit);
options.maxTime(maxTime, timeUnit);
return this;
} | java | {
"resource": ""
} |
q155278 | MappedClass.addAnnotation | train | public void addAnnotation(final Class<? extends Annotation> clazz, final Annotation ann) {
if (ann == null || clazz == null) {
return;
}
if (!foundAnnotations.containsKey(clazz)) {
foundAnnotations.put(clazz, new ArrayList<Annotation>());
}
foundAnnotati... | java | {
"resource": ""
} |
q155279 | MappedClass.callLifecycleMethods | train | @SuppressWarnings({"WMI", "unchecked"})
public DBObject callLifecycleMethods(final Class<? extends Annotation> event, final Object entity, final DBObject dbObj,
final Mapper mapper) {
final List<ClassMethodPair> methodPairs = getLifecycleMethods((Class<Annotation>) e... | java | {
"resource": ""
} |
q155280 | MappedClass.getAnnotation | train | public Annotation getAnnotation(final Class<? extends Annotation> clazz) {
final List<Annotation> found = foundAnnotations.get(clazz);
return found == null || found.isEmpty() ? null : found.get(found.size() - 1);
} | java | {
"resource": ""
} |
q155281 | MappedClass.getAnnotations | train | @SuppressWarnings("unchecked")
public <T> List<T> getAnnotations(final Class<? extends Annotation> clazz) {
return (List<T>) foundAnnotations.get(clazz);
} | java | {
"resource": ""
} |
q155282 | MappedClass.getFieldsAnnotatedWith | train | public List<MappedField> getFieldsAnnotatedWith(final Class<? extends Annotation> clazz) {
final List<MappedField> results = new ArrayList<MappedField>();
for (final MappedField mf : persistenceFields) {
if (mf.hasAnnotation(clazz)) {
results.add(mf);
}
}
... | java | {
"resource": ""
} |
q155283 | MappedClass.getFirstAnnotation | train | public Annotation getFirstAnnotation(final Class<? extends Annotation> clazz) {
final List<Annotation> found = foundAnnotations.get(clazz);
return found == null || found.isEmpty() ? null : found.get(0);
} | java | {
"resource": ""
} |
q155284 | MappedClass.getMappedField | train | public MappedField getMappedField(final String storedName) {
for (final MappedField mf : persistenceFields) {
for (final String n : mf.getLoadNames()) {
if (storedName.equals(n)) {
return mf;
}
}
}
return null;
} | java | {
"resource": ""
} |
q155285 | MappedClass.getMappedFieldByJavaField | train | public MappedField getMappedFieldByJavaField(final String name) {
for (final MappedField mf : persistenceFields) {
if (name.equals(mf.getJavaFieldName())) {
return mf;
}
}
return null;
} | java | {
"resource": ""
} |
q155286 | MappedClass.validate | train | @SuppressWarnings("deprecation")
public void validate(final Mapper mapper) {
new MappingValidator(mapper.getOptions().getObjectFactory()).validate(mapper, this);
} | java | {
"resource": ""
} |
q155287 | ValueValidator.apply | train | public boolean apply(final Class<?> type, final Object value, final List<ValidationFailure> validationFailures) {
if (getRequiredValueType().isAssignableFrom(value.getClass())) {
validate(type, value, validationFailures);
return true;
}
return false;
} | java | {
"resource": ""
} |
q155288 | GeoJson.polygon | train | public static Polygon polygon(final LineString exteriorBoundary, final LineString... interiorBoundaries) {
ensurePolygonIsClosed(exteriorBoundary);
for (final LineString boundary : interiorBoundaries) {
ensurePolygonIsClosed(boundary);
}
return new Polygon(exteriorBoundary, i... | java | {
"resource": ""
} |
q155289 | MorphiaCursor.toList | train | public List<T> toList() {
final List<T> results = new ArrayList<T>();
try {
while (wrapped.hasNext()) {
results.add(next());
}
} finally {
wrapped.close();
}
return results;
} | java | {
"resource": ""
} |
q155290 | DatastoreImpl.copy | train | @Deprecated
public DatastoreImpl copy(final String database) {
return new DatastoreImpl(morphia, mapper, mongoClient, database);
} | java | {
"resource": ""
} |
q155291 | DatastoreImpl.find | train | public <T, V> Query<T> find(final String collection, final Class<T> clazz, final String property, final V value, final int offset,
final int size, final boolean validate) {
final Query<T> query = find(collection, clazz);
if (!validate) {
query.disableValidatio... | java | {
"resource": ""
} |
q155292 | DatastoreImpl.insert | train | @Override
public <T> Iterable<Key<T>> insert(final Iterable<T> entities) {
return insert(entities, new InsertOptions()
.writeConcern(defConcern));
} | java | {
"resource": ""
} |
q155293 | DatastoreImpl.insert | train | public <T> Key<T> insert(final String collection, final T entity, final WriteConcern wc) {
return insert(getCollection(collection), ProxyHelper.unwrap(entity), new InsertOptions().writeConcern(wc));
} | java | {
"resource": ""
} |
q155294 | DatastoreImpl.getWriteConcern | train | private WriteConcern getWriteConcern(final Object clazzOrEntity) {
WriteConcern wc = defConcern;
if (clazzOrEntity != null) {
final Entity entityAnn = getMapper().getMappedClass(clazzOrEntity).getEntityAnnotation();
if (entityAnn != null && !entityAnn.concern().isEmpty()) {
... | java | {
"resource": ""
} |
q155295 | LazyFeatureDependencies.createDefaultProxyFactory | train | public static LazyProxyFactory createDefaultProxyFactory() {
if (testDependencyFullFilled()) {
final String factoryClassName = "dev.morphia.mapping.lazy.CGLibLazyProxyFactory";
try {
return (LazyProxyFactory) Class.forName(factoryClassName).newInstance();
} ca... | java | {
"resource": ""
} |
q155296 | MorphiaLoggerFactory.registerLogger | train | public static void registerLogger(final Class<? extends LoggerFactory> factoryClass) {
if (loggerFactory == null) {
FACTORIES.add(0, factoryClass.getName());
} else {
throw new IllegalStateException("LoggerImplFactory must be registered before logging is initialized.");
}... | java | {
"resource": ""
} |
q155297 | Converters.addConverter | train | public TypeConverter addConverter(final Class<? extends TypeConverter> clazz) {
return addConverter(mapper.getOptions().getObjectFactory().createInstance(clazz));
} | java | {
"resource": ""
} |
q155298 | Converters.addConverter | train | public TypeConverter addConverter(final TypeConverter tc) {
if (tc.getSupportedTypes() != null) {
for (final Class c : tc.getSupportedTypes()) {
addTypedConverter(c, tc);
}
} else {
untypedTypeEncoders.add(tc);
}
registeredConverterCla... | java | {
"resource": ""
} |
q155299 | Converters.removeConverter | train | public void removeConverter(final TypeConverter tc) {
if (tc.getSupportedTypes() == null) {
untypedTypeEncoders.remove(tc);
registeredConverterClasses.remove(tc.getClass());
} else {
for (final Entry<Class, List<TypeConverter>> entry : tcMap.entrySet()) {
... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.