code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@Override
public boolean apply(List<E> tokens) {
if (this.find(tokens) != null) {
return true;
} else {
return false;
}
} | java |
public Match<E> find(List<E> tokens, int start) {
Match<E> match;
for (int i = start; i <= tokens.size() - auto.minMatchingLength(); i++) {
match = this.lookingAt(tokens, i);
if (match != null) {
return match;
}
}
return null;
} | java |
public Match<E> lookingAt(List<E> tokens, int start) {
return auto.lookingAt(tokens, start);
} | java |
public List<Match<E>> findAll(List<E> tokens) {
List<Match<E>> results = new ArrayList<Match<E>>();
int start = 0;
Match<E> match;
do {
match = this.find(tokens, start);
if (match != null) {
start = match.endIndex();
// match may... | java |
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
RegularExpression<String> regex = RegularExpressionParsers.word.parse(args[0]);
System.out.println("regex: " + regex);
System.out.println();
while (scan.hasNextLine()) {
String line = sc... | java |
public boolean isEquivalent(CompilationUnit other) {
if (!destination.getAbsoluteFile().equals(other.destination.getAbsoluteFile())) return false;
if (encoding != null ? !encoding.equals(other.encoding) : other.encoding != null) return false;
if (resourceReader != null ? !resourceReader.equals(o... | java |
private static MessageDigest SHA512_Init() {
Log.d("Ed25519", "SHA512_Init");
try {
return MessageDigest.getInstance("SHA-512");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return null;
} | java |
public void addIndexWarning(String noIndexGiven) {
if (jsonResponse==null){
jsonResponse = new JSONObject();
}
jsonResponse.put("warning:noIndexGiven", noIndexGiven);
} | java |
public static DeleteFollowRequest checkRequest(
final HttpServletRequest request,
final DeleteRequest deleteRequest,
final DeleteFollowResponse deleteFollowResponse) {
final Node user = checkUserIdentifier(request, deleteFollowResponse);
if (user != null) {
final Node followed = checkFollowedIdentifier(... | java |
@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
long start = System.nanoTime();
ProcessRetrieveResponse responseObject = ProcessRetrieveRequest.checkRequestParameter(request,
this.getServletContext());
String resultJson = resp... | java |
private static CreateRequestType checkType(final FormItemList formItemList,
final CreateResponse createResponse) {
final String sType = formItemList
.getField(ProtocolConstants.Parameters.Create.TYPE);
if (sType != null) {
if (CreateRequestType.USER.getIdentifier().equals(sType)) {
return CreateReques... | java |
private void writeFiles(final StatusUpdateTemplate template,
final FormItemList items) throws Exception {
FormFile fileItem;
TemplateFileInfo fileInfo;
for (String fileIdentifier : items.getFileIdentifiers()) {
fileItem = items.getFile(fileIdentifier);
fileInfo = template.getFiles().get(fileIdentifier);
... | java |
private File writeFile(final FormFile fileItem) throws Exception {
final String directory = this.getFileDir(fileItem.getContentType());
// TODO: ensure unique file names
final File file = new File(directory + System.currentTimeMillis() + "-"
+ fileItem.getOriginalFileName());
fileItem.getFormItem().write(f... | java |
@SuppressWarnings("unchecked")
public JSONObject toJSONObject() {
final JSONObject activity = new JSONObject();
// parse time stamp
activity.put("published",
dateFormatter.format(new Date(this.timestamp)));
// TODO: check performance
// parse user
// final Map<String, Object> user = this.creator.toAc... | java |
protected Map<String, Object> toObjectJSON() {
final Map<String, Object> objectJSON = new LinkedHashMap<String, Object>();
// TODO: select correct object type - usage of own types allowed?
objectJSON.put("objectType", "article");
objectJSON.put("type", this.type);
objectJSON.put("id", this.id);
return obje... | java |
private static Properties loadProperties(String propertiesFile) {
Properties properties = new Properties();
try (InputStream is = new FileInputStream(propertiesFile)) {
properties.load(is);
} catch (IOException e) {
throw new RuntimeException("failed to load properties", e);
}
return pro... | java |
private static Properties loadPropertiesFromClasspath(String propertiesFile) {
Properties properties = new Properties();
try (InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertiesFile)) {
properties.load(is);
} catch (IOException e) {
throw new RuntimeExc... | java |
public <T> Collection<T> getCollection(String prefix, Function<String, T> factory) {
Collection<T> collection = new ArrayList<>();
for (String property : properties.stringPropertyNames()) {
if (property.startsWith(prefix + ".")) {
collection.add(factory.apply(property));
}
}
return c... | java |
public <K, V> Map<K, V> getMap(String prefix, Function<String, K> keyFactory, Function<String, V> valueFactory) {
Map<K, V> map = new HashMap<>();
for (String property : properties.stringPropertyNames()) {
if (property.startsWith(prefix + ".")) {
map.put(keyFactory.apply(property.substring(prefix.... | java |
public Class<?> getClass(String property) {
return getProperty(property, className -> {
try {
return Class.forName(className);
} catch (ClassNotFoundException e) {
throw new ConfigurationException("unknown class: " + className, e);
}
});
} | java |
public File getFile(String property, File defaultValue) {
return getProperty(property, defaultValue, File::new);
} | java |
public <T extends Enum<T>> T getEnum(String property, Class<T> type) {
return Enum.valueOf(type, getString(property));
} | java |
public String getString(String property, String defaultValue) {
return getProperty(property, defaultValue, v -> v);
} | java |
public boolean getBoolean(String property) {
return getProperty(property, value -> {
switch (value.trim().toLowerCase()) {
case "true":
case "1":
return true;
case "false":
case "0":
return false;
default:
throw new ConfigurationException("... | java |
public short getShort(String property) {
return getProperty(property, value -> {
try {
return Short.valueOf(value);
} catch (NumberFormatException e) {
throw new ConfigurationException("malformed property value: " + property + " must be a short");
}
});
} | java |
public int getInteger(String property) {
return getProperty(property, value -> {
try {
return Integer.valueOf(value);
} catch (NumberFormatException e) {
throw new ConfigurationException("malformed property value: " + property + " must be an integer");
}
});
} | java |
public long getLong(String property) {
return getProperty(property, value -> {
try {
return Long.valueOf(value);
} catch (NumberFormatException e) {
throw new ConfigurationException("malformed property value: " + property + " must be a long");
}
});
} | java |
public float getFloat(String property) {
return getProperty(property, value -> {
try {
return Float.valueOf(value);
} catch (NumberFormatException e) {
throw new ConfigurationException("malformed property value: " + property + " must be a float");
}
});
} | java |
public double getDouble(String property) {
return getProperty(property, value -> {
try {
return Double.valueOf(value);
} catch (NumberFormatException e) {
throw new ConfigurationException("malformed property value: " + property + " must be a double");
}
});
} | java |
private <T> T getProperty(String property, Function<String, T> transformer) {
Assert.notNull(property, "property");
String value = properties.getProperty(property);
if (value == null)
throw new ConfigurationException("missing property: " + property);
return transformer.apply(value);
} | java |
public void addFriend(Friend friend) {
try {
get().addEntry(friend.get());
} catch (NoResponseException | XMPPErrorException
| NotConnectedException e) {
e.printStackTrace();
}
} | java |
public boolean contains(Friend friend) {
for (final Friend f : getFriends()) {
if (StringUtils.parseName(f.getUserId()).equals(
StringUtils.parseName(friend.getUserId()))) {
return true;
}
}
return false;
} | java |
public List<Friend> getFriends() {
final List<Friend> friends = new ArrayList<>();
for (final RosterEntry e : get().getEntries()) {
friends.add(new Friend(api, con, e));
}
return friends;
} | java |
public void setName(String name) {
try {
get().setName(name);
} catch (final NotConnectedException e) {
e.printStackTrace();
}
} | java |
public static DeleteRequest checkRequest(final HttpServletRequest request,
final DeleteResponse deleteResponse) {
final DeleteRequestType type = checkType(request, deleteResponse);
if (type != null) {
return new DeleteRequest(type);
}
return null;
} | java |
private static DeleteRequestType checkType(
final HttpServletRequest request,
final DeleteResponse deleteResponse) {
{
final String sType = request
.getParameter(ProtocolConstants.Parameters.Delete.TYPE);
if (sType != null) {
if (DeleteRequestType.USER.getIdentifier().equals(sType)) {
return... | java |
public static ProcessRetrieveResponse checkRequestParameter(
HttpServletRequest request, ServletContext context) {
ProcessRetrieveResponse response = new ProcessRetrieveResponse(context);
Integer numItems = checkNumItems(request, response);
String term = checkTerm(request, response);
if (term == null) {
r... | java |
private static SuggestTree checkIndexName(HttpServletRequest request,
ProcessRetrieveResponse response, ServletContext context) {
String indexName = request
.getParameter(ProtocolConstants.INDEX_PARAMETER);
SuggestTree index = null;
// if no indexName Parameter was provided use the default index.
if (ind... | java |
public static org.neo4j.graphdb.Node createTemplateFileInfoNode(
final AbstractGraphDatabase graphDatabase,
final TemplateFileInfo fileInfo) {
final org.neo4j.graphdb.Node fileNode = TemplateItemInfo
.createTemplateItemNode(graphDatabase, fileInfo);
fileNode.setProperty(TemplateXMLFields.FILE_CONTENT_TYPE... | java |
@SuppressWarnings("unchecked")
public void addActivityStream(final List<JSONObject> activities) {
final JSONArray items = new JSONArray();
for (JSONObject activity : activities) {
items.add(activity);
}
this.json.put("items", items);
} | java |
protected static CatalystThread getThread(ExecutorService executor) {
final AtomicReference<CatalystThread> thread = new AtomicReference<>();
try {
executor.submit(() -> {
thread.set((CatalystThread) Thread.currentThread());
}).get();
} catch (InterruptedException | ExecutionException e)... | java |
public static org.neo4j.graphdb.Node createTemplateFieldInfoNode(
final AbstractGraphDatabase graphDatabase,
final TemplateFieldInfo fieldInfo) {
final org.neo4j.graphdb.Node fieldNode = TemplateItemInfo
.createTemplateItemNode(graphDatabase, fieldInfo);
fieldNode
.setProperty(TemplateXMLFields.FIELD_... | java |
public static BitArray allocate(long bits) {
if (!(bits > 0 & (bits & (bits - 1)) == 0))
throw new IllegalArgumentException("size must be a power of 2");
return new BitArray(UnsafeHeapBytes.allocate(Math.max(bits / 8 + 8, 8)), bits);
} | java |
public boolean set(long index) {
if (!(index < size))
throw new IndexOutOfBoundsException();
if (!get(index)) {
bytes.writeLong(offset(index), bytes.readLong(offset(index)) | (1l << position(index)));
count++;
return true;
}
return false;
} | java |
public boolean get(long index) {
if (!(index < size))
throw new IndexOutOfBoundsException();
return (bytes.readLong(offset(index)) & (1l << (position(index)))) != 0;
} | java |
public BitArray resize(long size) {
bytes.resize(Math.max(size / 8 + 8, 8));
this.size = size;
return this;
} | java |
BufferAllocator allocator() {
Class<?> allocator = reader.getClass(ALLOCATOR, UnpooledUnsafeHeapAllocator.class);
try {
return (BufferAllocator) allocator.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
throw new ConfigurationException(e);
} catch (ClassCastExcep... | java |
private int idToInt(String value) {
try {
return Integer.valueOf(value);
} catch (NumberFormatException e) {
throw new ConfigurationException("invalid type ID: " + value);
}
} | java |
private Class<?> serializerToClass(String value) {
try {
return Thread.currentThread().getContextClassLoader().loadClass(value);
} catch (ClassNotFoundException e) {
throw new ConfigurationException("unknown serializable type: " + value);
}
} | java |
CompletableFuture<Void> connect(LocalConnection connection) {
LocalConnection localConnection = new LocalConnection(listener.context, connections);
connections.add(localConnection);
connection.connect(localConnection);
localConnection.connect(connection);
return CompletableFuture.runAsync(() -> list... | java |
public Serializer registerClassLoader(String className, ClassLoader classLoader) {
classLoaders.put(className, classLoader);
return this;
} | java |
@SuppressWarnings("unchecked")
private BufferOutput writeById(int id, Object object, BufferOutput output, TypeSerializer serializer) {
for (Identifier identifier : Identifier.values()) {
if (identifier.accept(id)) {
identifier.write(id, output.writeByte(identifier.code()));
serializer.write(... | java |
@SuppressWarnings("unchecked")
private BufferOutput writeByClass(Class<?> type, Object object, BufferOutput output, TypeSerializer serializer) {
if (whitelistRequired.get())
throw new SerializationException("cannot serialize unregistered type: " + type);
serializer.write(object, output.writeByte(Identif... | java |
@SuppressWarnings("unchecked")
private <T> T readById(int id, BufferInput<?> buffer) {
Class<T> type = (Class<T>) registry.type(id);
if (type == null)
throw new SerializationException("cannot deserialize: unknown type");
TypeSerializer<T> serializer = getSerializer(type);
if (serializer == null... | java |
@SuppressWarnings("unchecked")
private <T> T readByClass(BufferInput<?> buffer) {
String name = buffer.readUTF8();
if (whitelistRequired.get())
throw new SerializationException("cannot deserialize unregistered type: " + name);
Class<T> type = (Class<T>) types.get(name);
if (type == null) {
... | java |
public static org.neo4j.graphdb.Node createTemplateNode(
final AbstractGraphDatabase graphDatabase,
final StatusUpdateTemplate template) {
final org.neo4j.graphdb.Node templateNode = graphDatabase.createNode();
// write template information
templateNode.setProperty(Properties.Templates.IDENTIFIER,
temp... | java |
public void createUser(final String userId, final String displayName,
final String profilePicturePath) {
final Node user = NeoUtils.createUserNode(userId);
user.setProperty(Properties.User.DISPLAY_NAME, displayName);
user.setProperty(Properties.User.PROFILE_PICTURE_PATH,
profilePicturePath);
} | java |
public void deleteUser(final Node user) {
Node userReplica, following;
for (Relationship replica : user.getRelationships(
SocialGraphRelationshipType.REPLICA, Direction.INCOMING)) {
userReplica = replica.getEndNode();
following = NeoUtils.getPrevSingleNode(userReplica,
SocialGraphRelationshipType.FOL... | java |
private int getInt(XMLProperty p, int defaultValue) {
final String value = get(p);
if (value.isEmpty()) {
return defaultValue;
}
return Integer.parseInt(value);
} | java |
public void start() {
this.workerThread = new Thread(this);
System.out.println("starting worker thread");
this.workerThread.start();
System.out.println("worker thread started");
} | java |
private void sendRequest(Object request, ContextualFuture future) {
if (open && connection.open) {
long requestId = ++this.requestId;
futures.put(requestId, future);
connection.handleRequest(requestId, request);
} else {
future.context.executor().execute(() -> future.completeExceptionall... | java |
private void handleResponseError(long requestId, Throwable error) {
ContextualFuture future = futures.remove(requestId);
if (future != null) {
future.context.execute(() -> future.completeExceptionally(error));
}
} | java |
@SuppressWarnings("unchecked")
private void handleRequest(long requestId, Object request) {
HandlerHolder holder = handlers.get(request.getClass());
if (holder == null) {
connection.handleResponseError(requestId, new ConnectException("no handler registered"));
return;
}
Function<Object, C... | java |
private static Map<String, String> loadDatabaseConfig(
final Configuration config) {
// create database configuration
final Map<String, String> databaseConfig = new HashMap<String, String>();
// fill database configuration
databaseConfig.put("cache_type", config.getCacheType());
databaseConfig.put("use_me... | java |
private static void loadLuceneIndices(
final AbstractGraphDatabase graphDatabase) {
INDEX_STATUS_UPDATE_TEMPLATES = graphDatabase.index().forNodes("tmpl");
INDEX_USERS = graphDatabase.index().forNodes("user");
INDEX_STATUS_UPDATES = graphDatabase.index().forNodes("stup");
} | java |
public static AbstractGraphDatabase getSocialGraphDatabase(
final Configuration config) {
// prepare neo4j graph configuration
final Map<String, String> graphConfig = loadDatabaseConfig(config);
// load database from path specified
AbstractGraphDatabase database;
if (config.getReadOnly()) {
database = ... | java |
public static boolean deleteFile(final File file) {
// delete directory content recursively
if (file.isDirectory()) {
final File[] children = file.listFiles();
for (File child : children) {
if (!deleteFile(child)) {
return false;
}
}
}
// delete file/empty directory
return file.delete()... | java |
public static Node getPrevSingleNode(final Node user,
RelationshipType relationshipType) {
// find an incoming relation of the type specified
final Relationship rel = user.getSingleRelationship(relationshipType,
Direction.INCOMING);
return (rel == null) ? (null) : (rel.getStartNode());
} | java |
public static Node getNextSingleNode(final Node user,
RelationshipType relationshipType) {
// find an outgoing relation of the type specified
Relationship rel = null;
try {
rel = user.getSingleRelationship(relationshipType,
Direction.OUTGOING);
} catch (final NonWritableChannelException e) {
// TO... | java |
public static Relationship getRelationshipBetween(final Node source,
final Node target, final RelationshipType relationshipType,
final Direction direction) {
for (Relationship relationship : source.getRelationships(
relationshipType, direction)) {
if (relationship.getEndNode().equals(target)) {
retur... | java |
public static Node createUserNode(final String userId) {
if (INDEX_USERS.get(IDENTIFIER, userId).getSingle() == null) {
final Node user = DATABASE.createNode();
user.setProperty(Properties.User.IDENTIFIER, userId);
INDEX_USERS.add(user, IDENTIFIER, userId);
return user;
}
throw new IllegalArgumentExc... | java |
public static Node createStatusUpdateNode(final String statusUpdateId) {
if (INDEX_STATUS_UPDATES.get(IDENTIFIER, statusUpdateId).getSingle() == null) {
final Node statusUpdate = DATABASE.createNode();
statusUpdate.setProperty(Properties.StatusUpdate.IDENTIFIER,
statusUpdateId);
INDEX_STATUS_UPDATES.add... | java |
public static void storeStatusUpdateTemplateNode(
final AbstractGraphDatabase graphDatabase, final String templateId,
final Node templateNode, final Node previousTemplateNode) {
// remove node of the latest previous template version
if (previousTemplateNode != null) {
INDEX_STATUS_UPDATE_TEMPLATES.remove(p... | java |
public void start() {
this.commandWorker.start();
while (!this.commandWorker.isRunning()) {
// wait for the command worker to be ready
System.out.println("waiting for worker to connect...");
try {
Thread.sleep(50);
} catch (final InterruptedException e) {
System.out.println("server thread could ... | java |
private void handleRequestFailure(long requestId, Throwable error, ThreadContext context) {
ByteBuf buffer = channel.alloc().buffer(10)
.writeByte(RESPONSE)
.writeLong(requestId)
.writeByte(FAILURE);
try {
writeError(buffer, error, context);
} catch (SerializationException e) {
... | java |
void handleResponse(ByteBuf response) {
long requestId = response.readLong();
byte status = response.readByte();
switch (status) {
case SUCCESS:
try {
handleResponseSuccess(requestId, readResponse(response));
} catch (SerializationException e) {
handleResponseFailur... | java |
@SuppressWarnings("unchecked")
private void handleResponseSuccess(long requestId, Object response) {
ContextualFuture future = responseFutures.remove(requestId);
if (future != null) {
future.context.executor().execute(() -> future.complete(response));
}
} | java |
private void handleResponseFailure(long requestId, Throwable t) {
ContextualFuture future = responseFutures.remove(requestId);
if (future != null) {
future.context.executor().execute(() -> future.completeExceptionally(t));
}
} | java |
private ByteBuf writeRequest(ByteBuf buffer, Object request, ThreadContext context) {
context.serializer().writeObject(request, OUTPUT.get().setByteBuf(buffer));
if (request instanceof ReferenceCounted) {
((ReferenceCounted) request).release();
}
return buffer;
} | java |
private ByteBuf writeResponse(ByteBuf buffer, Object request, ThreadContext context) {
context.serializer().writeObject(request, OUTPUT.get().setByteBuf(buffer));
return buffer;
} | java |
private ByteBuf writeError(ByteBuf buffer, Throwable t, ThreadContext context) {
context.serializer().writeObject(t, OUTPUT.get().setByteBuf(buffer));
return buffer;
} | java |
private Object readRequest(ByteBuf buffer) {
return context.serializer().readObject(INPUT.get().setByteBuf(buffer));
} | java |
private Throwable readError(ByteBuf buffer) {
return context.serializer().readObject(INPUT.get().setByteBuf(buffer));
} | java |
void handleException(Throwable t) {
if (failure == null) {
failure = t;
for (ContextualFuture<?> responseFuture : responseFutures.values()) {
responseFuture.context.executor().execute(() -> responseFuture.completeExceptionally(t));
}
responseFutures.clear();
for (Listener<Thr... | java |
void handleClosed() {
if (!closed) {
closed = true;
for (ContextualFuture<?> responseFuture : responseFutures.values()) {
responseFuture.context.executor().execute(() -> responseFuture.completeExceptionally(new ConnectException("connection closed")));
}
responseFutures.clear();
... | java |
void timeout() {
long time = System.currentTimeMillis();
Iterator<Map.Entry<Long, ContextualFuture>> iterator = responseFutures.entrySet().iterator();
while (iterator.hasNext()) {
ContextualFuture future = iterator.next().getValue();
if (future.time + requestTimeout < time) {
iterator.re... | java |
protected static org.neo4j.graphdb.Node createTemplateItemNode(
final AbstractGraphDatabase graphDatabase,
final TemplateItemInfo itemInfo) {
final org.neo4j.graphdb.Node itemNode = graphDatabase.createNode();
itemNode.setProperty(TemplateXMLFields.ITEM_NAME, itemInfo.getName());
return itemNode;
} | java |
public static CreateUserRequest checkRequest(
final FormItemList formItemList, final CreateRequest createRequest,
final CreateUserResponse createUserResponse) {
final String userId = checkUserIdentifier(formItemList,
createUserResponse);
if (userId != null) {
final String displayName = checkDisplayName... | java |
private static String checkDisplayName(final FormItemList formItemList,
final CreateUserResponse createUserResponse) {
final String displayName = formItemList
.getField(ProtocolConstants.Parameters.Create.User.DISPLAY_NAME);
if (displayName != null) {
return displayName;
} else {
createUserResponse.d... | java |
private static String checkProfilePicturePath(
final FormItemList formItemList,
final CreateUserResponse createUserResponse) {
final String profilePicturePath = formItemList
.getField(ProtocolConstants.Parameters.Create.User.PROFILE_PICTURE_PATH);
if (profilePicturePath != null) {
return profilePicture... | java |
public Listener<T> add(Consumer<T> listener) {
Assert.notNull(listener, "listener");
ListenerHolder holder = new ListenerHolder(listener, ThreadContext.currentContext());
listeners.add(holder);
return holder;
} | java |
public CompletableFuture<Void> accept(T event) {
List<CompletableFuture<Void>> futures = new ArrayList<>(listeners.size());
for (ListenerHolder listener : listeners) {
if (listener.context != null) {
futures.add(listener.context.execute(() -> listener.listener.accept(event)));
} else {
... | java |
private ThreadContext getOrCreateContext(Channel channel) {
ThreadContext context = ThreadContext.currentContext();
if (context != null) {
return context;
}
return new SingleThreadContext(Thread.currentThread(), channel.eventLoop(), this.context.serializer().clone());
} | java |
private void handleResponse(ByteBuf response, ChannelHandlerContext context) {
NettyConnection connection = getConnection(context.channel());
if (connection != null) {
connection.handleResponse(response);
}
} | java |
private int calculateTypeId(Class<?> type) {
if (type == null)
throw new NullPointerException("type cannot be null");
return hasher.hash32(type.getName());
} | java |
public SerializerRegistry registerDefault(Class<?> baseType, Class<? extends TypeSerializer> serializer) {
return registerDefault(baseType, new DefaultTypeSerializerFactory(serializer));
} | java |
public synchronized SerializerRegistry registerDefault(Class<?> baseType, TypeSerializerFactory factory) {
defaultFactories.put(baseType, factory);
return this;
} | java |
private Class<?> findBaseType(Class<?> type, Map<Class<?>, TypeSerializerFactory> factories) {
if (factories.containsKey(type))
return type;
List<Map.Entry<Class<?>, TypeSerializerFactory>> orderedFactories = new ArrayList<>(factories.entrySet());
Collections.reverse(orderedFactories);
Optional<... | java |
synchronized int id(Class<?> type) {
Integer id = ids.get(type);
if (id != null)
return id;
// If no ID was found for the given type, determine whether the type is an abstract type.
Class<?> baseType = findBaseType(type, abstractFactories);
if (baseType != null) {
id = ids.get(baseType)... | java |
@SuppressWarnings("unchecked")
private T readReference(Class<T> type, BufferInput<?> buffer, Serializer serializer) {
ReferencePool<?> pool = pools.get(type);
if (pool == null) {
Constructor<?> constructor = constructorMap.get(type);
if (constructor == null) {
try {
constructor =... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.